madewithlove / jenga
0.1.0
2017-04-07 14:08 UTC
Requires
- php: >5.6
- psr/container: ^1.0
- psr/http-message: ^1.0
Requires (Dev)
- league/container: ^2.4
- league/route: ^3.0
- phpunit/phpunit: ^5.7
- zendframework/zend-diactoros: ^1.3
This package is not auto-updated.
Last update: 2024-10-27 03:05:26 UTC
README
PSR-15 middleware stack builder with lazy resolving of middlewares from PSR-11 containers.
Installation
composer require madewithlove/jenga
Usage
$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);
Example
You can run an example application, if you have cloned this repository, using:
php -S 0.0.0.0:8000 example/index.php
Testing
After cloning this project, install its dependencies and run the test suite:
composer install vendor/bin/phpunit