Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 645 Bytes

README.md

File metadata and controls

27 lines (20 loc) · 645 Bytes

garveen/fastcgi-react

Simply serve fastcgi with reactphp

composer require garveen/fastcgi-react
require 'vendor/autoload.php';

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