garveen/fastcgi-react

Simply serve fastcgi with reactphp

0.1.0 2017-02-15 16:01 UTC

This package is not auto-updated.

Last update: 2024-12-22 01:46:37 UTC


README

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