PSR-15 middleware stack builder with lazy resolving of middlewares from PSR-11 containers.
composer require madewithlove/jenga
$middleware = [
new RobotsMiddleware(),
RouterMiddleware::class,
];
$stack = new Stack($psrContainer, $middlewares);
$psrResponse = $stack->call($psrServerRequest);
You can also plug in the Stack
object into a different PSR-15 middleware chain,
because it implements the MiddlewareInterface.
$psrResponse = $stack->process($psrServerRequest, $delegate);
You can run an example application, if you have cloned this repository, using:
php -S 0.0.0.0:8000 example/index.php
After cloning this project, install its dependencies and run the test suite:
composer install
vendor/bin/phpunit