Skip to content

Repository files navigation

ReactPHP Runtime

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.phpusePsr\Http\Server\RequestHandlerInterface;
usePsr\Http\Message\ServerRequestInterface;
usePsr\Http\Message\ResponseInterface;
useNyholm\Psr7;
require_oncedirname(__DIR__).'/vendor/autoload_runtime.php';
class Application implements RequestHandlerInterface {
// ...publicfunctionhandle(ServerRequestInterface$request): ResponseInterface
{
returnnewPsr7\Response(200, [], 'PSR-15');
}
}
returnfunction (array$context) {
returnnewApplication($context['APP_ENV'] ?? 'dev');
};

Options

OptionDescriptionDefault
hostThe host where the server should bind to (precedes REACT_HOST environment variable)127.0.0.1
portThe port where the server should be listening (precedes REACT_PORT environment variable)8080

About

[READ ONLY]

Topics

Resources

Stars

18 stars

Watchers

2 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages