summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2021-02-18 15:37:55 +0300
committerWolfy-J <[email protected]>2021-02-18 15:37:55 +0300
commit29f0d9e0da51f8c98c8d01e260eccfacf1072c01 (patch)
treec3e19a9e64fdf226028384681a3d5e75c749f0d8 /README.md
parent51d0f10096614bb300c439d5f973a805987fe4be (diff)
- update example in README.md
Signed-off-by: Wolfy-J <[email protected]>
Diffstat (limited to 'README.md')
-rw-r--r--README.md52
1 files changed, 45 insertions, 7 deletions
diff --git a/README.md b/README.md
index e00fcab8..066aaa62 100644
--- a/README.md
+++ b/README.md
@@ -51,7 +51,7 @@ Features:
- execTTL (brute, max_execution_time)
- Payload context and body
- Protocol, worker and job level error management (including PHP errors)
-- Very fast (~250k rpc calls per second on Ryzen 1700X using 16 threads)
+- Development Mode
- Integrations with Symfony, [Laravel](https://github.com/spiral/roadrunner-laravel), Slim, CakePHP, Zend Expressive
- Application server for [Spiral](https://github.com/spiral/framework)
- Automatic reloading on file changes
@@ -60,29 +60,67 @@ Features:
Installation:
--------
-```
-go get -u github.com/spiral/roadrunner/v2
+```bash
+$ composer require spiral/roadrunner:v2.0 nyholm/psr7
+$ ./vendor/bin/rr get-binary
```
-> For getting roadrunner binary file you can use our docker image: `spiralscout/roadrunner:X.X.X` (more information about image and tags can be found [here](https://hub.docker.com/r/spiralscout/roadrunner/))
+> For getting roadrunner binary file you can use our docker image: `spiralscout/roadrunner:X.X.X` (more information about
+> image and tags can be found [here](https://hub.docker.com/r/spiralscout/roadrunner/))
Configuration can be located in `.rr.yaml`
file ([full sample](https://github.com/spiral/roadrunner/blob/master/.rr.yaml)):
```yaml
+rpc:
+ listen: tcp://127.0.0.1:6001
+
+server:
+ command: "php worker.php"
+
http:
- address: 0.0.0.0:8080
- workers.command: "php worker.php"
+ address: "0.0.0.0:8080"
+
+logs:
+ level: error
```
> Read more in [Documentation](https://roadrunner.dev/docs).
+Example Worker:
+--------
+
+```php
+<?php
+
+use Spiral\RoadRunner;
+use Nyholm\Psr7;
+
+include "vendor/autoload.php";
+
+$worker = RoadRunner\Worker::create();
+$psrFactory = new Psr7\Factory\Psr17Factory();
+
+$worker = new RoadRunner\Http\PSR7Worker($worker, $psrFactory, $psrFactory, $psrFactory);
+
+while ($req = $worker->waitRequest()) {
+ try {
+ $rsp = new Psr7\Response();
+ $rsp->getBody()->write('Hello world!');
+
+ $worker->respond($rsp);
+ } catch (\Throwable $e) {
+ $worker->getWorker()->error((string)$e);
+ }
+}
+```
+
Run:
----
To run application server:
```
-$ ./rr serve -v -d
+$ ./rr serve
```
License: