Skip to content

Simple middleware stack runner for PSR-15 compatible middleware

License

Notifications You must be signed in to change notification settings

ideationnet/stack-runner

Repository files navigation

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 [email protected] instead of using the issue tracker.

Credits

License

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

About

Simple middleware stack runner for PSR-15 compatible middleware

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages