Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Latest commit

 

History

History
36 lines (28 loc) · 1.21 KB

usage.md

File metadata and controls

36 lines (28 loc) · 1.21 KB

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();