PHP code example of garveen / fastcgi-react

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

    

garveen / fastcgi-react example snippets




$loop = React\EventLoop\Factory::create();
$socket = new React\Socket\Server(9000, $loop);

$fastcgi = new Garveen\FastCgi\React($socket);

// see http://www.php-fig.org/psr/psr-7/
$fastcgi->onRequest = function (Psr\Http\Message\RequestInterface $request) {
    return new Garveen\FastCgi\Response(
        '200', // status code
        ['x-powered-by' => 'garveen/fastcgi-react'], // headers
        'Hello World!' // body
    );
};

$loop->run();