Download the PHP package celema/router without Composer
On this page you can find all versions of the php package celema/router. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download celema/router
More information about celema/router
Files in celema/router
Package router
Short Description PSR-7/PSR-15 router and dispatcher
License MIT
Homepage https://celema.dev/router
Informations about the package router
Celema Router
A PSR-7/PSR-15 compatible router and view dispatcher.
Using your PSR-7 request and response factory:
Routes
Define routes directly or inside callback groups. Configure groups only inside the group callback. Groups apply their prefix, name prefix, middleware, Before handlers, After handlers, and controller to every route in the group, even when those settings are declared after the route lines in the callback.
Preferred route actions are callables and controller method arrays:
Inside a controller group, use bare method names:
Dispatching
RoutingHandler implements PSR-15 RequestHandlerInterface. It matches the request through the router and dispatches the matched route through the dispatcher.
Routing exceptions bubble by default. Catch NotFoundException for 404 responses and MethodNotAllowedException for 405 responses.
Use the low-level match API when you need route inspection before dispatching:
Middleware and handlers run in this order:
- Dispatcher middleware
- Route middleware
- View middleware attributes
Beforehandlers immediately before the view- View execution
Afterhandlers for rendering or response changes
Use PSR middleware for cross-cutting request/response behavior. Use Before for final request changes before the view. Use After to render arbitrary view data or modify a response.
URL generation
Use named routes through the router. Generated URLs include the router prefix and fail fast when path params are missing, unknown, or do not match route constraints.
Static assets stay separate from named routes:
License
This project is licensed under the MIT license.
All versions of router with dependencies
psr/container Version ^2.0
psr/http-message Version ^1.1 || ^2.0
psr/http-message-implementation Version ^1.0
psr/http-server-handler Version ^1.0
psr/http-server-middleware Version ^1.0
celema/wire Version ^0.7