library middleware
Collection of PSR-15 middleware
benliev/middleware
Collection of PSR-15 middleware
- Wednesday, September 27, 2017
- by benliev
- Repository
- 0 Watchers
- 0 Stars
- 3 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 2 Versions
- 0 % Grown
PHP middleware
, (*1)
Collection of PSR-15 Middleware., (*2)
Requirements
PHP >= 7.1, (*3)
Installation
composer require benvens/middleware
Test
For test this library :, (*4)
composer test
Usage example
$responseFactory = new \Http\Factory\Guzzle\ResponseFactory();
$request = \GuzzleHttp\Psr7\ServerRequest::fromGlobals();
$response = (new Dispatcher())
->pipe(new TrailingSlashMiddleware($responseFactory))
->pipe(new MethodMiddleware())
->pipe(new CsrfMiddleware())
->pipe(new NotFoundMiddleware($responseFactory))
->process($request));
\Http\Response\send($response);
The dispatcher has the role of storing the middleware and then of executing them., (*5)
Available middlewares
- TrailingSlashMiddleware : Middleware to remove the trailing slash.
- MethodMiddleware : Middleware to override the request method using parameter _method provided in the request body.
- CsrfMiddleware : Middleware for CSRF protection.
- NotFoundMiddleware : Middleware to return a 404 response with Error 404 body. This middleware must be at the end of the dispatcher.
dev-master
9999999-dev
Collection of PSR-15 middleware
Sources
Download
MIT
The Requires
The Development Requires
by
Lievens Benjamin
1.0.0
1.0.0.0
Collection of PSR-15 middleware
Sources
Download
MIT
The Requires
The Development Requires
by
Lievens Benjamin