summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-07-29 01:03:28 +0300
committerGitHub <[email protected]>2018-07-29 01:03:28 +0300
commitefd8d2435e4ac07c5fe4a3726d16a4c58b54b9e2 (patch)
tree77777e140f925d1e87904286b0875d3ab366d8cb /README.md
parent8017bee81fa05bbe8c9d2d3f2459a20ad4071215 (diff)
Update README.md
Diffstat (limited to 'README.md')
-rw-r--r--README.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/README.md b/README.md
index e3b0931c..3a1213d6 100644
--- a/README.md
+++ b/README.md
@@ -54,6 +54,27 @@ Features:
- very fast (~250k rpc calls per second on Ryzen 1700X using 16 threads)
- works on Windows
+Example:
+--------
+
+```php
+ini_set('display_errors', 'stderr');
+
+$relay = new Spiral\Goridge\StreamRelay(STDIN, STDOUT);
+$psr7 = new Spiral\RoadRunner\PSR7Client(new Spiral\RoadRunner\Worker($relay));
+
+while ($req = $psr7->acceptRequest()) {
+ try {
+ $resp = new \Zend\Diactoros\Response()
+ $resp->getBody()->write("hello world");
+
+ $psr7->respond($resp);
+ } catch (\Throwable $e) {
+ $psr7->getWorker()->error((string)$e);
+ }
+}
+```
+
License:
--------
The MIT License (MIT). Please see [`LICENSE`](./LICENSE) for more information. Maintained by [SpiralScout](https://spiralscout.com).