ideationnet / stack-runner
Simple stack-runner for PSR-15 compatible middleware
Requires
- php: ~7.0
- http-interop/http-factory: ^0.3.0
- http-interop/http-server-middleware: ^1.0
- php-di/invoker: ^1.3
Requires (Dev)
- phpunit/phpunit: ^6.4
- squizlabs/php_codesniffer: ^3.1
This package is not auto-updated.
Last update: 2024-12-21 21:20:07 UTC
README
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
- PHP7+
- A stack of PSR-15 middleware, such as Router or Middlewares
- A PSR-17 HTTP factory
- An invoker compatible with InvokerInterface
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.