Skip to content
tzappa edited this page Mar 8, 2013 · 1 revision

Router

\Sugi\Router acts as a mapper between the HTTP requests (\Sugi\HTTP\Request) and your custom set of rules (\Sugi\HTTP\Route) to handle those requests.

Request

\Sugi\HTTP\Request represents a real HTTP request, giving you access to $_SERVER, $_GET, $_POST, $_COOKIE variables in a more convenient way. It also can produce customly defined requests mainly for unit testing purposes.

Route

\Sugi\HTTP\Route is a set of rules. If these rules match the request the router gives control to the function which is associated with the route. A simple MVC example: $route = new \Sugi\HTTP\Route( "/{controller}/{action}/{id}", array("controller" => "main", "action" => "index", "id" => "" ); Second parameter is an optional array with default values for the path variables.

Clone this wiki locally