implements Phalcon\Mvc\Router\GroupInterface
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 Group( [ "module" => "blog", "controller" => "index", ] ); //All the routes start with /blog $blog->setPrefix("/blog"); //Add a route to the group $blog->add( "/save", [ "action" => "save", ] ); //Add another route to the group $blog->add( "/edit/{id}", [ "action" => "edit", ] ); //This route maps to a controller different than the default $blog->add( "/blog", [ "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
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
Returns the ‘before match’ callback 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 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 route applying the common attributes
© 2011–2017 Phalcon Framework Team
Licensed under the Creative Commons Attribution License 3.0.
https://docs.phalconphp.com/en/latest/api/Phalcon_Mvc_Router_Group.html