When HTTP request gets into system, it needs to be process. Route tells the system how the request should be processed. By default, Koldy framework ships DefaultRoute which should cover 99% of all cases you might run into.
Every route class should be able to:
- Parse REQUEST_URI and know what is controller, what is action and what are parameters
- Should know where to look up for modules, controllers and actions
- Should execute action in controller and return response back to framework
- Should respect if controller has
- Know what to do when action execution fails, where to look up exception handler and execute it
We encourage you to use our DefaultRoute class, although you're not limited to use our routing class exclusively. Routing class has the same abstraction architecture just like logging, caching or mailing system, so it's possible to create custom routing class.
If framework fails to execute your method, it'll throw
controller or action (method) is not found, routing class should throw
Error handler customization depends on the routing class you're using, so check the
documentation on the routing class you're using.
Available Routing Classes
Currently, there's only one routing class available:
Custom Routing Class
To create custom routing class, create your own class anywhere within the include path, extend
\Koldy\Route\AbstractRoute, implement methods, set the new class as routing_class
and that's it.