Simple middleware stack runner for PSR-15 compatible middleware
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
tests
.gitignore
.scrutinizer.yml
.styleci.yml
.travis.yml
License.md
README.md
composer.json
phpunit.xml.dist

README.md

Stack Runner

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads StyleCI

A simple PSR-15 compatible middleware dispatcher.

v3 breaking changes: updated to use "http-interop/http-middleware" v0.5 where Delegate has been replaced with ResponseHandler.

Requirements

Install

Via Composer

$ composer require ideationnet/stack-runner

Usage

To instantiate directly, provide the stack of middleware, the invoker to use, and the response factory:

$runner = new IdNet\StackRunner($middleware, $invoker, $factory);
$response = $runner->dispatch($request);

Although you will probably use with your preferred DI Container rather than instantiating directly:

$runner = $container->get(StackRunner::class);

Here's configuration for PHP-DI, which is preferred, as the container also doubles as a compatible Invoker:

return [
    StackRunner::class => object()
        ->constructorParameter('stack', get('middleware')),
];

Security

If you discover any security related issues, please email darren@darrenmothersele.com instead of using the issue tracker.

Credits

License

The MIT License. Please see License File for more information.