0 follower

Final Class Yiisoft\Yii\Runner\FrankenPHP\FrankenPHPApplicationRunner

InheritanceYiisoft\Yii\Runner\FrankenPHP\FrankenPHPApplicationRunner » Yiisoft\Yii\Runner\ApplicationRunner

FrankenPHPApplicationRunner runs the Yii HTTP application using FrankenPHP worker mode.

Public Methods

Hide inherited methods

Method Description Defined By
__construct() Yiisoft\Yii\Runner\FrankenPHP\FrankenPHPApplicationRunner
run() Yiisoft\Yii\Runner\FrankenPHP\FrankenPHPApplicationRunner
runAndGetResponse() Runs the application and gets the response instead of emitting it. Yiisoft\Yii\Runner\FrankenPHP\FrankenPHPApplicationRunner
withTemporaryErrorHandler() Returns a new instance with the specified temporary error handler instance {@see ErrorHandler}. Yiisoft\Yii\Runner\FrankenPHP\FrankenPHPApplicationRunner

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( string $rootPath, boolean $debug false, boolean $checkEvents false, string|null $environment null, string $bootstrapGroup 'bootstrap-web', string $eventsGroup 'events-web', string $diGroup 'di-web', string $diProvidersGroup 'di-providers-web', string $diDelegatesGroup 'di-delegates-web', string $diTagsGroup 'di-tags-web', string $paramsGroup 'params-web', array $nestedParamsGroups = ['params'], array $nestedEventsGroups = ['events'], object[] $configModifiers = [], string $configDirectory 'config', string $vendorDirectory 'vendor', string $configMergePlanFile '.merge-plan.php', \Yiisoft\ErrorHandler\ErrorHandler|null $temporaryErrorHandler null, \Yiisoft\PsrEmitter\EmitterInterface|null $emitter null )
$rootPath string

The absolute path to the project root.

$debug boolean

Whether the debug mode is enabled.

$checkEvents boolean

Whether to check events' configuration.

$environment string|null

The environment name.

$bootstrapGroup string

The bootstrap configuration group name.

$eventsGroup string

The events' configuration group name.

$diGroup string

The container definitions' configuration group name.

$diProvidersGroup string

The container providers' configuration group name.

$diDelegatesGroup string

The container delegates' configuration group name.

$diTagsGroup string

The container tags' configuration group name.

$paramsGroup string

The configuration parameters group name.

$nestedParamsGroups array

Configuration group names that are included in a configuration parameters group. This is needed for recursive merging of parameters.

$nestedEventsGroups array

Configuration group names that are included in events' configuration group. This is needed for the reverse and recursive merge of events' configurations.

$configModifiers object[]

Modifiers for {@see \Yiisoft\Yii\Runner\FrankenPHP\Config}.

$configDirectory string

The relative path from {@see $rootPath} to the configuration storage location.

$vendorDirectory string

The relative path from {@see $rootPath} to the vendor directory.

$configMergePlanFile string

The relative path from {@see $configDirectory} to merge plan.

$temporaryErrorHandler \Yiisoft\ErrorHandler\ErrorHandler|null

The temporary error handler instance that used to handle the creation of configuration and container instances, then the error handler configured in your application configuration will be used.

$emitter \Yiisoft\PsrEmitter\EmitterInterface|null

The emitter instance to send the response with. By default, it uses {@see \Yiisoft\PsrEmitter\SapiEmitter}.

                public function __construct(
    string $rootPath,
    bool $debug = false,
    bool $checkEvents = false,
    ?string $environment = null,
    string $bootstrapGroup = 'bootstrap-web',
    string $eventsGroup = 'events-web',
    string $diGroup = 'di-web',
    string $diProvidersGroup = 'di-providers-web',
    string $diDelegatesGroup = 'di-delegates-web',
    string $diTagsGroup = 'di-tags-web',
    string $paramsGroup = 'params-web',
    array $nestedParamsGroups = ['params'],
    array $nestedEventsGroups = ['events'],
    array $configModifiers = [],
    string $configDirectory = 'config',
    string $vendorDirectory = 'vendor',
    string $configMergePlanFile = '.merge-plan.php',
    private ?ErrorHandler $temporaryErrorHandler = null,
    ?EmitterInterface $emitter = null,
) {
    $this->emitter = $emitter ?? new SapiEmitter();
    parent::__construct(
        $rootPath,
        $debug,
        $checkEvents,
        $environment,
        $bootstrapGroup,
        $eventsGroup,
        $diGroup,
        $diProvidersGroup,
        $diDelegatesGroup,
        $diTagsGroup,
        $paramsGroup,
        $nestedParamsGroups,
        $nestedEventsGroups,
        $configModifiers,
        $configDirectory,
        $vendorDirectory,
        $configMergePlanFile,
    );
}

            
run() public method

public run ( )
throws \Yiisoft\Definitions\Exception\CircularReferenceException|ErrorException|\Yiisoft\Definitions\Exception\InvalidConfigException|JsonException
throws \Psr\Container\ContainerExceptionInterface|\Yiisoft\Di\NotFoundException|\Psr\Container\NotFoundExceptionInterface|\Yiisoft\Definitions\Exception\NotInstantiableException

                public function run(): void
{
    $this->runInternal($this->emitter);
}

            
runAndGetResponse() public method

Runs the application and gets the response instead of emitting it.

This method is useful for testing purposes or when you want to handle the response.

public \Psr\Http\Message\ResponseInterface runAndGetResponse ( \Psr\Http\Message\ServerRequestInterface|null $request null )
$request \Psr\Http\Message\ServerRequestInterface|null

The server request to handle (optional).

return \Psr\Http\Message\ResponseInterface

The response generated by the application.

throws \Yiisoft\Definitions\Exception\CircularReferenceException|ErrorException|\Yiisoft\PsrEmitter\HeadersHaveBeenSentException|\Yiisoft\Definitions\Exception\InvalidConfigException
throws \Psr\Container\ContainerExceptionInterface|\Yiisoft\Di\NotFoundException|\Psr\Container\NotFoundExceptionInterface|\Yiisoft\Definitions\Exception\NotInstantiableException

                public function runAndGetResponse(?ServerRequestInterface $request = null): ResponseInterface
{
    $this->runInternal(
        $this->fakeEmitter ??= new FakeEmitter(),
        $request,
    );
    return $this->fakeEmitter->getLastResponse()
        ?? throw new LogicException('No response was emitted.');
}

            
withTemporaryErrorHandler() public method

Returns a new instance with the specified temporary error handler instance {@see ErrorHandler}.

A temporary error handler is needed to handle the creation of configuration and container instances, then the error handler configured in your application configuration will be used.

public self withTemporaryErrorHandler ( \Yiisoft\ErrorHandler\ErrorHandler $temporaryErrorHandler )
$temporaryErrorHandler \Yiisoft\ErrorHandler\ErrorHandler

The temporary error handler instance.

                public function withTemporaryErrorHandler(ErrorHandler $temporaryErrorHandler): self
{
    $new = clone $this;
    $new->temporaryErrorHandler = $temporaryErrorHandler;
    return $new;
}