ideationnet/stack-runner

Simple stack-runner for PSR-15 compatible middleware

4.0 2017-11-14 10:28 UTC

This package is not auto-updated.

Last update: 2024-04-13 17:51:57 UTC


README

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.