Download the PHP package dakujem/generic-middleware without Composer
On this page you can find all versions of the php package dakujem/generic-middleware. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dakujem/generic-middleware
More information about dakujem/generic-middleware
Files in dakujem/generic-middleware
Package generic-middleware
Short Description Generic PSR-15 implementation: Turns callables into Handlers and Middleware.
License Unlicense
Informations about the package generic-middleware
Generic PSR-15 Middleware & Handlers
💿
composer require dakujem/generic-middleware
Contains a couple of classes:
GenericMiddleware
, an implementation ofPsr\Http\Server\MiddlewareInterface
GenericHandler
, an implementation ofPsr\Http\Server\RequestHandlerInterface
Note that I'm using aliases
Request
,Response
andHandler
for their respective PSR interface names for brevity.Consider the following
use
statements in use:
GenericMiddleware
The GenericMiddleware
is a general purpose middleware that turns a callable into a PSR-15 implementation.
It accepts any callable with signature fn(Request,Handler):Response
.
It can be used for convenient inline middleware implementation:
GenericHandler
The GenericHandler
is a general purpose request handler, as per the PSR-15 specification.
It turns a callable with signature fn(Request):Response
into a PSR-15 implementation.
It can be used for convenient inline handler implementation where you don't want to bother with neither anonymous classes nor named classes:
Testing
Run unit tests using the following command:
$
composer test
Contributing
Ideas, feature requests and other contribution is welcome. Please send a PR or create an issue.