A few months earlier I blogged about developing PHP Router, a PHP5.3+ routing class with support for REST routing and reversed routing.
Well, last week I came across klein.php, a lightweight PHP router developed by Chris O’Hara. I particularly liked the fact that it’s pretty easy to specify certain type restrictions for your URL parameters so I decided to create my own version of klein.php. The aim was to create something that worked in a similar way as my own PHP Router class, but with the easiness of klein.php.
So, here it is: AltoRouter, a tiny routing class which will help you in your future PHP projects.
- Usage of different HTTP Methods
- Dynamic routing, which lets you capture certain uri segments as parameters
- REST Routing
- Reversed routing, generate URL’s from route names while supplying parameter values
- Parameter types
Have a look at the code. Tell me what you like / don’t like so we can improve AltoRouter together!