This is a simple PHP routing class. This is a scalable project, it's meant to be something you can just drop right into your site and use, but it's also meant to be a good foundation for building and understanding routing systems.
- Make sure you're using this on a server which supports PHP!
If you need to install a server on your local machine, try MAMP. - Place
index.php,router.php, and.htaccessin the directory which you wish to route. - An instance of router is initialized in
index.phpwith an array containing the routes by using this syntax:
new Router(array(
'/path-to-route' => 'file-to-route-to.php',
'/another-path-to-route' => 'another-file-to-route-to.php',
// etc
));It's that simple!