Skip to content
PHP Ecosystem
Explore

FrankenPHP

API reference › FrankenPHP › FrankenPHP

final classyii2\extensions\frankenphp\FrankenPHP
Sourcesrc/FrankenPHP.php

Runs the FrankenPHP worker loop for a Yii PSR bridge application.

Creates a PSR request from SAPI globals, emits the response, and finalizes the bridge lifecycle once per request. HEAD responses omit the body. See the README quick start for the entry script and required factory bindings.

MethodDescriptionDefined by
__construct()Creates a new instance of the FrankenPHP class.FrankenPHP
run()Runs the FrankenPHP worker loop for handling HTTP requests.FrankenPHP
ConstantValueDescriptionDefined by
DEFAULT_MAX_REQUESTS1000Default maximum number of requests to handle before stopping the worker loop.FrankenPHP
public function __construct(yii2\extensions\psrbridge\http\Application $app, int|null $maxRequests = null)

Creates a new instance of the FrankenPHP class.

Parameters

ParameterTypeDescription
$appyii2\extensions\psrbridge\http\ApplicationApplication instance.
$maxRequestsint|nullMaximum number of requests to handle before stopping. If null, will try to read from $_ENV['MAX_REQUESTS'] or the process environment, otherwise defaults to ‘1000’.
public function run(): int

Runs the FrankenPHP worker loop for handling HTTP requests.

Returns

int: Exit code indicating the result of the worker loop execution (ServerExitCode::OK for success, ServerExitCode::REQUEST_LIMIT for request limit reached).

Throws

  • Throwable: if an exception occurs during request handling or response emission.