blob: d382098af42281bf40d6fb672c9689c57d0abff7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
<?php
use Spiral\RoadRunner;
use Nyholm\Psr7\Factory;
ini_set('display_errors', 'stderr');
include "vendor/autoload.php";
$worker = new RoadRunner\Http\PSR7Worker(
RoadRunner\Worker::create(),
new Factory\Psr17Factory(),
new Factory\Psr17Factory(),
new Factory\Psr17Factory()
);
while ($req = $worker->waitRequest()) {
try {
$rsp = new \Nyholm\Psr7\Response();
$rsp->getBody()->write("hello world");
$worker->respond($rsp);
} catch (\Throwable $e) {
$worker->getWorker()->error((string)$e);
}
}
|