PHP code example of bileto / http

1. Go to this page and download the library: Download bileto/http 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/ */

    

bileto / http example snippets


    $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();