runtime/react

ReactPHP runtime

Maintainers

👁 Nyholm

Package info

github.com/php-runtime/reactphp

pkg:composer/runtime/react

Fund package maintenance!

nyholm

Statistics

Installs: 5 518

Dependents: 1

Suggesters: 0

Stars: 18

Open Issues: 0

1.0.0 2025-12-18 07:34 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 1260b4a5de493da362f74ae5816838f88b0ba99d

  • Tobias Nyholm <tobias.nyholm.woop@gmail.com>

This package is auto-updated.

Last update: 2026-06-18 08:48:29 UTC


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');
};

Options

Option Description Default
host The host where the server should bind to (precedes REACT_HOST environment variable) 127.0.0.1
port The port where the server should be listening (precedes REACT_PORT environment variable) 8080