blob: 3f6408bf640d7bf11595afa5c67d7f260d9343d1 (
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
25
|
<?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");
error_log("hello");
$worker->respond($rsp);
} catch (\Throwable $e) {
$worker->getWorker()->error((string)$e);
}
}
|