|Classes of devg
> This package deprecated and no more develop. See
Extremely simple router for small web applications. Small footprint, no overhead.
Router class in this package can route HTTP requests by URL pattern to callbacks.
It can register URL patterns to match and associates callback functions to each pattern.
When the current request URL matches one of the patterns, the respective callback function is called to handle the request.
You may install this component via Composer:
Or download this repository and include file Router.php directly and place in your application directory.
Your webserver must point to the index.php file for any URI entered. See
Get Instance of Router class.
Add your route rules. Routes may contents exact or wildcard-rules.
Route handler may be any callable (function name, closure) or string with controller class name and action method.
Router instantiate controller and execute action method automatically.
Note if you using Composer, add your controller classes to autoloading.
Add single rule with Closure handler:
Or/and define routes as array.
Start route processing.
Usage example see in