0.1.0 2017-04-07 14:08 UTC

This package is not auto-updated.

Last update: 2024-09-29 02:34:06 UTC


README

Build Status

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

License

MIT