Recently I had some spare time and decided to rewrite the PHP Router I’ve been using on many of my recent projects. I prefer to have my projects setup with .htaccess which redirects all page requests to index.php which uses my router to decide which function to call. This approach allows me to write very clean, modular code.
My new router is very flexible, supports unit testing and can be extended. I’ve attached the source code to this post as well as an example of how to use it.