Helper class to create a group of routes with common attributes
$router = new Phalcon\Mvc\Router();
//Create a group with a common module and controller
$blog = new Phalcon\Mvc\Router\Group(array(
'module' => 'blog',
'controller' => 'index'
));
//All the routes start with /blog
$blog->setPrefix('/blog');
//Add a route to the group
$blog->add('/save', array(
'action' => 'save'
));
//Add another route to the group
$blog->add('/edit/{id}', array(
'action' => 'edit'
));
//This route maps to a controller different than the default
$blog->add('/blog', array(
'controller' => 'about',
'action' => 'index'
));
//Add the group to the router
$router->mount($blog);
Phalcon\Mvc\Router\Group constructor
Set a hostname restriction for all the routes in the group
Returns the hostname restriction
Set a common uri prefix for all the routes in this group
Returns the common prefix for all the routes
Set a before-match condition for the whole group
Returns the before-match condition if any
Set common paths for all the routes in the group
Returns the common paths defined for this group
Returns the routes added to the group
Adds a route applying the common attributes
Adds a route to the router on any HTTP method
$router->add('/about', 'About::index');
Adds a route to the router that only match if the HTTP method is GET
Adds a route to the router that only match if the HTTP method is POST
Adds a route to the router that only match if the HTTP method is PUT
Adds a route to the router that only match if the HTTP method is PATCH
Adds a route to the router that only match if the HTTP method is DELETE
Add a route to the router that only match if the HTTP method is OPTIONS
Adds a route to the router that only match if the HTTP method is HEAD
Removes all the pre-defined routes
Adds a converter to perform an additional transformation for certain parameter
Returns the router converter
Set the name of the group
Returns the name of this group
© 2011–2016 Phalcon Framework Team
Licensed under the Creative Commons Attribution License 3.0.
https://docs.phalconphp.com/en/2.0.0/api/Phalcon_Mvc_Router_Group.html