The routing component
blaze's routing component is rather simple but fine tuned for small website projects. It wont do fancy stuff like routing requests to controllers, but it will handle all requests properly and imitate the natural behaviour of your webserver so you don't have to change any habits.
The routing component itself is available via this object:
During the routing process, the routing component will split up the requested path into an array and look for files that could match. The routing component will eventually hold some information about the identified file which you can access with the following methods.
Recommended available methods
The router will resolve the current route to an array which will match the folder structure of your webroot. This method will return an array where the array elements represent the folders to traverse, starting in the domain's root folder. The last array element will hold the filename of the final file.
For instance: Let's imagine you have called
http://yourdomain.com/testfolder/test and there is a
test.php in this folder,
getResolvedRoute() will return an array like this:
This method will return a string which holds the actual route which was input to the router after mod_rewrite and htaccess did their work.
Continuing the for instance from above, this method would return the string
Just a little helper. This method returns a string holding the url which was called by the visitor. Let's continue the for instance: It would return
Other available methods
There are some other public methods but we'd not recommend using them as they are intended for internal usage. If you are looking for documentation, please read the in-code comments.