Skip to content

Commit d191d58

Browse files
committed
Second Readme fix iteration
1 parent 39d328e commit d191d58

File tree

1 file changed

+56
-70
lines changed

1 file changed

+56
-70
lines changed

README.md

Lines changed: 56 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -22,44 +22,47 @@ You should definitely use this package if:
2222
![RoadRunner](https://github.com/user-attachments/assets/609d2e29-b6af-478b-b350-1d27b77ed6fb)
2323

2424
> [!TIP]
25-
> [There is an article][rr-plugins-article] that explains all the RoadRunner plugins:
25+
> [There is an article][rr-plugins-article] that explains all the RoadRunner plugins.
2626
27+
## Table of Contents
2728

28-
Table of content:
29-
30-
- [Installation](#installation)
31-
- [Usage](#usage)
32-
- [RoadRunner Worker Configuration](#roadrunner-worker-configuration)
29+
- [Get Started](#get-started)
30+
- [Installation](#installation)
31+
- [Configuration](#configuration)
32+
- [Starting the Server](#starting-the-server)
3333
- [How It Works](#how-it-works)
3434
- [Supported Plugins](#supported-plugins)
3535
- [HTTP Plugin](#http-plugin)
3636
- [Jobs (Queue) Plugin](#jobs-queue-plugin)
3737
- [gRPC Plugin](#grpc-plugin)
3838
- [Temporal](#temporal)
39-
- [Custom Workers]
39+
- [Custom Workers](#custom-workers)
40+
- [Support](#support)
41+
- [License](#license)
42+
43+
## Get Started
44+
45+
### Installation
4046

41-
## Installation
47+
First, install the Laravel Bridge package via Composer:
4248

43-
```shell script
49+
```shell
4450
composer require roadrunner-php/laravel-bridge
4551
```
4652

47-
After that you can "publish" package configuration file (`./config/roadrunner.php`) using next command:
53+
Publish the configuration file:
4854

49-
```shell script
55+
```shell
5056
php artisan vendor:publish --provider='Spiral\RoadRunnerLaravel\ServiceProvider' --tag=config
5157
```
5258

53-
## Usage
59+
Download and install RoadRunner binary using DLoad:
5460

55-
After package installation, you can download and install [RoadRunner][roadrunner] binary
56-
using [DLoad][dload] package:
57-
58-
```bash
61+
```shell
5962
./vendor/bin/dload get rr
6063
```
6164

62-
### Basic Configuration (.rr.yaml)
65+
### Configuration
6366

6467
Create a `.rr.yaml` configuration file in your project root:
6568

@@ -70,7 +73,6 @@ rpc:
7073

7174
server:
7275
command: 'php vendor/bin/rr-worker start'
73-
relay: pipes
7476

7577
http:
7678
address: 0.0.0.0:8080
@@ -87,50 +89,27 @@ http:
8789
forbid: [ ".php" ]
8890
```
8991
90-
## RoadRunner Worker Configuration
92+
### Starting the Server
9193
92-
You can configure workers in `config/roadrunner.php` file in the `workers` section:
94+
Start the RoadRunner server with:
9395
94-
```php
95-
use Spiral\RoadRunner\Environment\Mode;
96-
use Spiral\RoadRunnerLaravel\Grpc\GrpcWorker;
97-
use Spiral\RoadRunnerLaravel\Http\HttpWorker;
98-
use Spiral\RoadRunnerLaravel\Queue\QueueWorker;
99-
use Spiral\RoadRunnerLaravel\Temporal\TemporalWorker;
100-
101-
return [
102-
// ... other configuration options ...
103-
104-
'workers' => [
105-
Mode::MODE_HTTP => HttpWorker::class,
106-
Mode::MODE_JOBS => QueueWorker::class,
107-
Mode::MODE_GRPC => GrpcWorker::class,
108-
Mode::MODE_TEMPORAL => TemporalWorker::class,
109-
],
110-
];
96+
```shell
97+
./rr serve
11198
```
11299

113-
As you can see, there are several predefined workers for HTTP, Jobs, gRPC, and Temporal. Feel free to replace any of
114-
them with your implementation if needed. Or create your own worker, for example,
115-
for [Centrifugo](https://docs.roadrunner.dev/docs/plugins/centrifuge), [TCP](https://docs.roadrunner.dev/docs/plugins/tcp)
116-
or any other plugin.
117-
118100
## How It Works
119101

120-
In the server section of the RoadRunner config, we specify the command to start our worker:
102+
RoadRunner creates a worker pool by executing the command specified in the server configuration:
121103

122104
```yaml
123105
server:
124106
command: 'php vendor/bin/rr-worker start'
125-
relay: pipes
126107
```
127108
128-
When RoadRunner server creates a worker pool for a specific plugin, it exposes an environment variable `RR_MODE` that
129-
indicates which plugin is being used. Our worker checks this variable to determine which Worker class should handle the
130-
request based on the configuration in `roadrunner.php`.
109+
When RoadRunner creates a worker pool for a specific plugin, it sets the `RR_MODE` environment variable to indicate which plugin is being used.
110+
The Laravel Bridge checks this variable to determine which Worker class should handle the request based on your configuration.
131111

132-
The selected worker starts listening for requests from the RoadRunner server and handles them using the Octane worker,
133-
which clears the application state after each task (request, command, etc.).
112+
The selected worker then listens for requests from the RoadRunner server and handles them using the Octane worker, which clears the application state after each task (request, command, etc.).
134113

135114
## Supported Plugins
136115

@@ -153,16 +132,15 @@ http:
153132
forbid: [ ".php" ]
154133
```
155134

156-
> **Note:** Read more about the HTTP plugin in
157-
> the [RoadRunner documentation][https://docs.roadrunner.dev/docs/http/http].
135+
> **Note:** Read more about the HTTP plugin in the [RoadRunner documentation](https://docs.roadrunner.dev/docs/http/http).
158136

159137
### Jobs (Queue) Plugin
160138

161-
The Queue plugin allows you to use RoadRunner as a queue driver for Laravel.
139+
The Queue plugin allows you to use RoadRunner as a queue driver for Laravel without additional services like Redis or a database.
162140

163141
#### Configuration
164142

165-
First, add the Queue Service Provider in your `config/app.php`:
143+
First, add the Queue Service Provider in `config/app.php`:
166144

167145
```php
168146
'providers' => [
@@ -171,7 +149,7 @@ First, add the Queue Service Provider in your `config/app.php`:
171149
],
172150
```
173151

174-
Then, configure a new connection in your `config/queue.php`:
152+
Then, configure a new connection in `config/queue.php`:
175153

176154
```php
177155
'connections' => [
@@ -197,17 +175,17 @@ jobs:
197175
config: { }
198176
```
199177

200-
> **Note:** Read more about the Jobs plugin in
201-
> the [RoadRunner documentation][https://docs.roadrunner.dev/docs/queues-and-jobs/overview-queues].
202-
203-
Don't forget to set the `QUEUE_CONNECTION` environment variable in your `.env` file:
178+
Set the `QUEUE_CONNECTION` environment variable in your `.env` file:
204179

205180
```dotenv
206181
QUEUE_CONNECTION=roadrunner
207182
```
208183

209184
That's it! You can now dispatch jobs to the RoadRunner queue without any additional services like Redis or Database.
210185

186+
> [!TIP]
187+
> Read more about the Jobs plugin in the [RoadRunner documentation](https://docs.roadrunner.dev/docs/queues-and-jobs/overview-queues).
188+
211189
### gRPC Plugin
212190

213191
The gRPC plugin enables serving gRPC services with your Laravel application.
@@ -268,36 +246,44 @@ return [
268246
];
269247
```
270248

271-
Download Temporal binary for development purposes using the following command:
249+
Download Temporal binary for development:
272250

273251
```bash
274252
./vendor/bin/dload get temporal
275253
```
276254

277-
To start the Temporal server, you can use the following command:
255+
Start the Temporal dev server:
278256

279257
```bash
280258
./temporal server start-dev --log-level error --color always
281259
```
282260

283-
#### Useful links
261+
#### Useful Links
284262

285263
- [PHP SDK on GitHub](https://github.com/temporalio/sdk-php)
286264
- [PHP SDK docs](https://docs.temporal.io/develop/php/)
287265
- [Code samples](https://github.com/temporalio/samples-php)
288266
- [Taxi service sample](https://github.com/butschster/podlodka-taxi-service)
289267

290-
## Starting RoadRunner Server
268+
## Custom Workers
291269

292-
To start the RoadRunner server:
270+
As you can see, there are several predefined workers for HTTP, Jobs, gRPC, and Temporal in `'workers'` section of `config/roadrunner.php`.
271+
You can replace them with your own implementations if needed or create your own workers for other plugins, for example,
272+
for [Centrifugo](https://docs.roadrunner.dev/docs/plugins/centrifuge), [TCP](https://docs.roadrunner.dev/docs/plugins/tcp)
273+
or any other plugin.
293274

294-
```shell script
295-
./rr serve
275+
```php
276+
return [
277+
'workers' => [
278+
Mode::MODE_HTTP => HttpWorker::class,
279+
Mode::MODE_JOBS => QueueWorker::class,
280+
Mode::MODE_GRPC => GrpcWorker::class,
281+
Mode::MODE_TEMPORAL => TemporalWorker::class,
282+
],
283+
];
296284
```
297285

298-
## Custom Workers
299-
300-
You can create your own custom workers by implementing the `Spiral\RoadRunnerLaravel\WorkerInterface`:
286+
To create your own custom workers start from implementing the `Spiral\RoadRunnerLaravel\WorkerInterface`:
301287

302288
```php
303289
namespace App\Workers;
@@ -395,6 +381,6 @@ MIT License (MIT). Please see [`LICENSE`](./LICENSE) for more information.
395381

396382
[roadrunner-binary-releases]:https://github.com/roadrunner-server/roadrunner/releases
397383

398-
[octane]https://laravel.com/docs/12.x/octane
384+
[octane]:https://laravel.com/docs/12.x/octane
399385

400-
[rr-plugins-article]https://butschster.medium.com/roadrunner-an-underrated-powerhouse-for-php-applications-46410b0abc
386+
[rr-plugins-article]:https://butschster.medium.com/roadrunner-an-underrated-powerhouse-for-php-applications-46410b0abc

0 commit comments

Comments
 (0)