3 A simple Rails inspired PHP router class.
5 * Usage of different HTTP Methods
6 * REST / Resourceful routing
7 * Reversed routing using named routes
8 * Dynamic URL's: use URL segments as parameters.
16 $router = new Router();
18 $router->setBasePath('/PHP-Router');
20 // defining routes can be as simple as this
21 $router->map('/', 'users#index');
23 // or somewhat more complicated
24 $router->map('/users/:id/edit/', array('controller' => 'SomeController', 'action' => 'someAction'), array('methods' => 'GET,PUT', 'name' => 'users_edit'));
26 // match current request URL & http method
27 $target = $router->matchCurrentRequest();
31 $router->generate('users_edit', array('id' => 5));
35 Have a look at the example.php file or read trough the class' documentation for a better understanding on how to use this class.