runtime / react
ReactPHP runtime
Fund package maintenance!
nyholm
Installs: 4 744
Dependents: 1
Suggesters: 0
Security: 0
Stars: 14
Watchers: 3
Forks: 5
Open Issues: 0
Requires
- php: >=8.0.5
- psr/http-server-handler: ^1.0
- react/http: ^1.6
- symfony/runtime: ^5.4 || ^6.0 || ^7.0
Requires (Dev)
- phpunit/phpunit: ^9.5
README
A runtime for ReactPHP.
If you are new to the Symfony Runtime component, read more in the main readme.
Installation
composer require runtime/react
Usage
Define the environment variable APP_RUNTIME
for your application.
APP_RUNTIME=Runtime\React\Runtime
PSR-15
// public/index.php use Psr\Http\Server\RequestHandlerInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ResponseInterface; use Nyholm\Psr7; require_once dirname(__DIR__).'/vendor/autoload_runtime.php'; class Application implements RequestHandlerInterface { // ... public function handle(ServerRequestInterface $request): ResponseInterface { return new Psr7\Response(200, [], 'PSR-15'); } } return function (array $context) { return new Application($context['APP_ENV'] ?? 'dev'); };