Download the PHP package middlewares/fast-route without Composer
On this page you can find all versions of the php package middlewares/fast-route. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download middlewares/fast-route
More information about middlewares/fast-route
Files in middlewares/fast-route
Package fast-route
Short Description Middleware to use FastRoute
License MIT
Homepage https://github.com/middlewares/fast-route
Informations about the package fast-route
middlewares/fast-route
Middleware to use FastRoute for handler discovery.
Requirements
- PHP >= 7.2
- A PSR-7 http library
- A PSR-15 middleware dispatcher
Installation
This package is installable and autoloadable via Composer as middlewares/fast-route.
You may also want to install middlewares/request-handler.
Example
This example uses middlewares/request-handler to execute the route handler:
FastRoute allows anything to be defined as the router handler (a closure, callback, action object, controller class, etc). The middleware will store this handler in a request attribute.
Usage
Create the middleware with a FastRoute\Dispatcher
instance:
Optionally, you can provide a Psr\Http\Message\ResponseFactoryInterface
as the second argument, that will be used to create the error responses (404
or 405
). If it's not defined, Middleware\Utils\Factory will be used to detect it automatically.
attribute
Changes the attribute name used to store the handler in the server request. The default name is request-handler
.
Please see CONTRIBUTING for contributing details.
The MIT License (MIT). Please see LICENSE for more information.
All versions of fast-route with dependencies
nikic/fast-route Version ^1.0
middlewares/utils Version ^3.0
psr/http-server-middleware Version ^1.0