Skip to content

Routing

szeber edited this page Aug 16, 2012 · 4 revisions

Purpose

The routing system's purpose is to match request targets (URIs in case of HTTP requests) to controller actions. The routers do this by retrieving the target from the request object. Each router may provide different functionality.

Router implementations

  • AutoRouter This is the simplest type of router. It splits the target by the path separator and tries to locate the controller matching the first, and the action matching the second part.
  • ArrayRouter This router has all the possible routes predefined in an array, and looks for the requested target in that array. It supports routes with parameters.
  • ConfigRouter This router simply extends the ArrayRouter, and retrieves the route array from a configuration value.

Good to know

  • By default the error pages don't have to be included in the routing table, because the request will be redirected there by some automatized mechanisms. So if you need to use your current URI by any reason on an error page you can encounter bad surprises(Unhandled Exception), to avoid this add your error pages to your routing table, or be prepared to catch these exceptions.
Clone this wiki locally