PHP code example of revolt / event-loop-adapter-react
1. Go to this page and download the library: Download revolt/event-loop-adapter-react library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
revolt / event-loop-adapter-react example snippets
eact\EventLoop\Loop;
use Revolt\EventLoop;
$app = function ($request, $response) {
$response->writeHead(200, array('Content-Type' => 'text/plain'));
$response->end("Hello World\n");
};
$socket = new React\Socket\Server(Loop::get());
$http = new React\Http\Server($socket, Loop::get());
$http->on('request', $app);
echo "Server running at http://127.0.0.1:1337\n";
$socket->listen(1337);
EventLoop::run();