hulotte / middleware-dispatcher
A PSR-15 middleware dispatcher
1.0.0
2020-12-24 17:06 UTC
Requires
- php: ^8.0
- guzzlehttp/psr7: ^1.7.0
- http-interop/response-sender: ^1.0.0
- psr/http-message: ^1.0.1
- psr/http-server-middleware: ^1.0.1
Requires (Dev)
- phpunit/phpunit: ^9.5.0
- squizlabs/php_codesniffer: ^3.5.8
This package is auto-updated.
Last update: 2025-03-25 02:50:59 UTC
README
Description
Hulotte Middleware Dispatcher is a package that allows you to manage the launch of middlewares with a queue system. This package respects PSR15 standards.
Installation
The easiest way to install Hulotte Middleware Dispatcher is to use Composer with this command :
$ composer require hulotte/middleware-dispatcher
How to use Hulotte Middleware Dispatcher ?
First, instanciate the MiddlewareDispatcher class with an array of middlewares.
$dispatcher = new \Hulotte\Middlewares\MiddlewareDispatcher([ new Middleware1(), new Middleware2(), ]);
the order of the middlewares in the array is important: it represents the order in which the middlewares will be played.
Now you can call the handle method. The request must implement the ServerRequestInterface (PSR7 standards).
$dispatcher->handle($request);