Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/debuss/borsch-middlewares
A collection of common middleware for Borsch applications.
https://github.com/debuss/borsch-middlewares
Last synced: about 1 month ago
JSON representation
A collection of common middleware for Borsch applications.
- Host: GitHub
- URL: https://github.com/debuss/borsch-middlewares
- Owner: debuss
- License: mit
- Created: 2020-04-28T03:09:27.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-05-01T12:59:49.000Z (over 4 years ago)
- Last Synced: 2024-04-04T03:01:06.637Z (9 months ago)
- Language: PHP
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Borsch - Middlewares
A collection of common PSR-15 Middleware for Borsch applications.
This package is part of the Borsch Framework.
## Installation
Via [composer](https://getcomposer.org/) :
`composer require borsch/middlewares`
## Usage
```php
require_once __DIR__.'/vendor/autoload.php';use Borsch\RequestHandler\RequestHandler;
use Borsch\Middleware\ErrorHandlerMiddleware;
use Borsch\Middleware\RouteMiddleware;
use Borsch\Middleware\ImplicitHeadMiddleware;
use Borsch\Middleware\ImplicitOptionsMiddleware;
use Borsch\Middleware\MethodNotAllowedMiddleware;
use \Borsch\Middleware\DispatchMiddleware;
use \Borsch\Middleware\NotFoundHandlerMiddleware;$request_handler = new RequestHandler();
$request_handler->middlewares([
ErrorHandlerMiddleware::class,
RouteMiddleware::class,
ImplicitHeadMiddleware::class,
ImplicitOptionsMiddleware::class,
MethodNotAllowedMiddleware::class,
DispatchMiddleware::class,
NotFoundHandlerMiddleware::class
]);$response = $request_handler->handle(ServerRequestFactory::fromGlobals());
```## License
The package is licensed under the MIT license. See [License File](https://github.com/debuss/borsch-middlewares/blob/master/LICENSE.md) for more information.