implements Phalcon\Mvc\Router\RouteInterface
This class represents every route added to the router
Phalcon\Mvc\Router\Route constructor
Replaces placeholders from pattern returning a valid PCRE regular expression
Set one or more HTTP methods that constraint the matching of the route
$route->via('GET'); $route->via(array('GET', 'POST'));
Extracts parameters from a string
Reconfigure the route adding a new pattern and a set of paths
Returns routePaths
Returns the route’s name
Sets the route’s name
$router->add('/about', array( 'controller' => 'about' ))->setName('about');
Sets a callback that is called if the route is matched. The developer can implement any arbitrary conditions here If the callback returns false the route is treated as not matched
$router->add('/login', array( 'module' => 'admin', 'controller' => 'session' ))->beforeMatch(function ($uri, $route) { // Check if the request was made with Ajax if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'xmlhttprequest') { return false; } return true; });
Returns the ‘before match’ callback if any
Allows to set a callback to handle the request directly in the route
$router->add("/help", array())->match(function () { return $this->getResponse()->redirect('https://support.google.com/', true); });
Returns the ‘match’ callback if any
Returns the route’s id
Returns the route’s pattern
Returns the route’s compiled pattern
Returns the paths
Returns the paths using positions as keys and names as values
Sets a set of HTTP methods that constraint the matching of the route (alias of via)
$route->setHttpMethods('GET'); $route->setHttpMethods(array('GET', 'POST'));
Returns the HTTP methods that constraint matching the route
Sets a hostname restriction to the route
$route->setHostname('localhost');
Returns the hostname restriction if any
Sets the group associated with the route
Returns the group associated with the route
Adds a converter to perform an additional transformation for certain parameter
Returns the router converter
Resets the internal route id generator
© 2011–2016 Phalcon Framework Team
Licensed under the Creative Commons Attribution License 3.0.
https://docs.phalconphp.com/en/latest/api/Phalcon_Mvc_Router_Route.html