You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Added
- Package "binary" file allows using next options:
- `laravel-path` for Laravel application base path changing
- `relay-dsn` for RR relay changing (you can set `tcp://localhost:6001`, `unix:///tmp/rpc.sock` and others; `pipes` is used by default)
- `refresh-app` for application instance refreshing on each incoming HTTP request (instead `APP_REFRESH` env variable)
- Possibility to use unix socket or TCP port as a relay to communicate with RoadRunner
- `Spiral\RoadRunnerLaravel\WorkerOptionsInterface` that describes worker starting options
- Feature tests (`phpunit`) that uses real RR server running
### Changed
- Minimal required PHP version now is `7.4`
- Dependency `spiral/roadrunner` (`~1.8`) changed with `spiral/roadrunner-worker` and `spiral/roadrunner-http` (`^2.0`)
- RR worker instance binding for DI from `Spiral\RoadRunner\PSR7Client` to `Spiral\RoadRunner\Http\PSR7Worker`
- `Spiral\RoadRunnerLaravel\WorkerInterface::start` accepts `Spiral\RoadRunnerLaravel\WorkerOptionsInterface` now
### Removed
- RR config file (`.rr.yaml`) publishing using `artisan vendor:publish` command
- Listener `Spiral\RoadRunnerLaravel\Listeners\ResetDbConnectionsListener`
Copy file name to clipboardExpand all lines: README.md
+44-36Lines changed: 44 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,35 +17,41 @@ Easy way for connecting [RoadRunner][roadrunner] and [Laravel][laravel] applicat
17
17
18
18
## Installation
19
19
20
-
Require this package with composer using next command:
20
+
Make sure that [RR binary file][roadrunner-binary-releases] already installed on your system (or docker image). Require this package with composer using next command:
And basic RoadRunner configuration file (`./.rr.yaml.dist`):
34
+
**Important**: despite the fact that worker allows you to refresh application instance on each HTTP request _(if worker started with option `--refresh-app`, eg.: `php ./vendor/bin/rr-worker start --refresh-app`)_, we strongly recommend avoiding this for performance reasons. Large applications can be hard to integrate with RoadRunner _(you must decide which of service providers must be reloaded on each request, avoid "static optimization" in some cases)_, but it's worth it.
After that you can modify configuration files as you wish.
43
-
44
-
**Important**: despite the fact that worker allows you to refresh application instance on each HTTP request _(if environment variable `APP_REFRESH` set to `true`)_, we strongly recommend to avoid this for performance reasons. Large applications can be hard to integrate with RoadRunner _(you must decide which of service providers must be reloaded on each request, avoid "static optimization" in some cases)_, but it's worth it.
- Update RR binary file (using [`roadrunner-cli`][roadrunner-cli] or download from [binary releases][roadrunner-binary-releases] page) up to `v2.x`
49
+
- Update RoadRunner starting (`rr serve ...`) flags - `-v` and `-d` must be not used anymore
50
+
- In your application code replace `Spiral\RoadRunner\PSR7Client` with `Spiral\RoadRunner\Http\PSR7Worker`
45
51
46
52
## Usage
47
53
48
-
After package installation you can use provided "binary" file as RoadRunner worker: `./vendor/bin/rr-worker`. This worker allows you to interact with incoming requests and outcoming responses using [laravel events system][laravel_events]. Also events contains:
54
+
After package installation you can use provided "binary" file as RoadRunner worker: `./vendor/bin/rr-worker`. This worker allows you to interact with incoming requests and outgoing responses using [laravel events system][laravel_events]. Event contains:
command: 'php ./vendor/bin/rr-worker'# for windows: `php vendor/spiral/roadrunner-laravel/bin/rr-worker`
70
-
pool:
71
-
numWorkers: 4
72
-
maxJobs: 64# jobs limitation is important
73
-
74
-
static:
75
-
dir: 'public'
77
+
middleware: ["headers", "static", "gzip"]
78
+
pool:
79
+
max_jobs: 64 # feel free to change this
80
+
supervisor:
81
+
exec_ttl: 60s
82
+
headers:
83
+
response:
84
+
X-Powered-By: "RoadRunner"
85
+
static:
86
+
dir: "public"
87
+
forbid: [".php"]
76
88
```
77
89
90
+
**Socket** or **TCP port** relay usage is strongly recommended for avoiding problems with `dd()`, `dump()`, `echo()` and other similar functions, that sends data to the IO pipes.
91
+
78
92
Roadrunner server starting:
79
93
80
94
```shell script
81
-
$ rr -c ./.rr.yaml serve -d
95
+
$ rr serve -c ./.rr.yaml
82
96
```
83
97
84
98
### Listeners
85
99
86
-
This package provides event listeners for resetings application state without full application reload _(like cookies, HTTP request, application instance, service-providers and other)_. Some of them already declared in configuration file, but you can declare own without any limitations.
`APP_REFRESH` | Refresh application instance on every request
100
+
This package provides event listeners for resetting application state without full application reload _(like cookies, HTTP request, application instance, service-providers and other)_. Some of them already declared in configuration file, but you can declare own without any limitations.
96
101
97
102
### Known issues
98
103
99
104
#### Controller constructors
100
105
101
-
You should avoid to use HTTP controller constructors _(created or resolved instances in constructor can be shared between different requests)_. Use dependencies resolving in controller **methods** instead.
106
+
You should avoid to use HTTP controller constructors _(created or resolved instances in a constructor can be shared between different requests)_. Use dependencies resolving in a controller **methods** instead.
102
107
103
108
Bad:
104
109
@@ -266,7 +271,7 @@ Changes log can be [found here][link_changes_log].
266
271
[![Issues][badge_issues]][link_issues]
267
272
[![Issues][badge_pulls]][link_pulls]
268
273
269
-
If you will find any package errors, please, [make an issue][link_create_issue] in current repository.
274
+
If you find any package errors, please, [make an issue][link_create_issue] in a current repository.
270
275
271
276
## License
272
277
@@ -294,6 +299,9 @@ MIT License (MIT). Please see [`LICENSE`](./LICENSE) for more information. Maint
0 commit comments