Routes

Routes are classes that must:
• know how to parse REQUEST_URI
• decide which controller needs to be initialized
• decide which method must be called in controller
• handle HTTP error you throw with Application:error()
• show some response if framework catches Exception
• know how to generate URLs (for step 1)

Simple as that. Koldy comes with one or few predefined route classes but if you really want, you can make your own routing class. Its not that hard after all.

Predefined routes in framework

Default Route: \Koldy\Application\Route\DefaultRoute

Making your own routing class

Its easy. Define your own class in /application/library, make sure that you extend \Koldy\Application\Route\AbstractRoute and implement all abstract methods. After that, go to configs/application.php and under routing_class set the name of your class and define routing_options if your routing class requires options.

Example: if you defined your routing class in /application/library/Site/CustomRoute.php, then you must define namespace Site and class name CustomRoute in CustomRoute.php. After that, under routing_class set \Site\CustomRoute and thats it.

Project StructureInput Parameters