Installation and Usage

To install this package, run the following composer command:

$ composer require zendframework/zend-httphandlerrunner

The package provides both emitters and the request handler runner, and these are generally used within the bootstrap of your application.

We recommend using a dependency injection container to define your various instances, including the PSR-15 request handler representing your application, the response emitter, the server request factory, the server request error response generator, potentially, the runner itself.

The example below instantiates the runner manually by pulling its dependencies from a configured PSR-11 container.

use Zend\HttpHandlerRunner\Emitter\EmitterStack;
use Zend\HttpHandlerRunner\RequestHandlerRunner;

$container = require 'config/container.php';

$runner = new RequestHandlerRunner(
    $container->get(ApplicationRequestHandler::class),
    $container->get(EmitterStack::class),
    $container->get('ServerRequestFactory'),
    $container->get('ServerRequestErrorResponseGenerator')
);
$runner->run();

Found a mistake or want to contribute to the documentation? Edit this page on GitHub!