Library for building an evented http server.
This component builds on top of the Socket component to implement HTTP. Here
are the main concepts:
This is an HTTP server which responds with Hello World to every request.
$loop = React\EventLoop\Factory::create(); $socket = new React\Socket\Server($loop); $http = new React\Http\Server($socket); $http->on('request', function ($request, $response) { $response->writeHead(200, array('Content-Type' => 'text/plain')); $response->end("Hello World!\n"); }); $socket->listen(1337); $loop->run();