Download the PHP package bonfim/router without Composer
On this page you can find all versions of the php package bonfim/router. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bonfim/router
More information about bonfim/router
Files in bonfim/router
Package router
Short Description A fast and powerful router that maps route callbacks to specific HTTP request methods and URIs.
License MIT
Homepage https://github.com/EdsonOnildoJR/Router
Informations about the package router
Router
Install
Via Composer
Basic Usage
Include the autoloader of composer:
and define your routes:
Routing
The routing is done by matching a URL pattern with a callback function:
The callback can be any object that is callable. So you can use a regular function:
Or a class method:
Or an object method:
Routes are matched in the order they are defined. The first route to match a request will be invoked.
Method Routing
The router allows you to register routes that respond to any HTTP verb:
You may register a route that responds to multiple verbs using the method:
Or, you may even register a route that responds to all HTTP verbs using the method:
Named Parameters
You may specify named parameters in your routes which will be passed along to your callback function:
You can also include regular expressions with your named parameters by using the : delimiter:
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
Contributing
Please see CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Edson Onildo
- All Contributors
License
The MIT License (MIT). Please see License File for more information.