Fork me on GitHub

Router & Route

The Router class is in place to enable total URI parsing. This is needed so that there is no extended memory or cpu loss in parsing the query string over and over again to find the best suited match.

The way this works is you add a Route object to the Router stack with a resource identifier which looks like a path. Say you want to disclose all posts in a forum, you might call the resource /forum/posts. This is the resource identifier, and the starting endpoint for all actions within your posts. The actions (INDEX, GET, POST, PUT, DELETE) are handled through the files in the module directory.

You can easily create this route like this:


The rest is done via the module handler.