AltoRouter

AltoRouter is a small but powerful routing class for PHP 5.3+, heavily inspired by klein.php.

$router = new AltoRouter (); // map homepage $router -> map ( 'GET' , '/' , function () { require __DIR__ . '/views/home.php' ; }); // map users details page $router -> map ( 'GET|POST' , '/users/[i:id]/' , function ( $id ) { $user = ..... require __DIR__ . '/views/user/details.php' ; });

Router Features

HTTP methods

Dynamic routing with (named) route parameters

Flexible regular expression routing, inspired by Sinatra

Reversed routing

Custom regexes

Using AltoRouter

To use AltoRouter in your project you need a web server running PHP 5.3 or newer.

Contributors

Released under the MIT Public License.

© 2012-2018 Danny van Kooten