1$loop = React\EventLoop\Factory::create();
2
3$server = new React\Http\Server($loop, function (Psr\Http\Message\ServerRequestInterface $request) {
4 return new React\Http\Message\Response(
5 200,
6 array(
7 'Content-Type' => 'text/plain'
8 ),
9 "Hello World!\n"
10 );
11});
12
13$socket = new React\Socket\Server(8080, $loop);
14$server->listen($socket);
15
16echo "Server running at http://127.0.0.1:8080\n";
17
18$loop->run();