Class Phalcon\Mvc\Router\Group

<?php$router=new\Phalcon\Mvc\Router();//Create a group with a common module and controller$blog=newGroup(["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);

Methods

public __construct ([mixed $paths])

Phalcon\Mvc\Router\Group constructor

public setHostname (mixed $hostname)

Set a hostname restriction for all the routes in the group

public getHostname ()

Returns the hostname restriction

public setPrefix (mixed $prefix)

Set a common uri prefix for all the routes in this group

public getPrefix ()

Returns the common prefix for all the routes

public beforeMatch (mixed $beforeMatch)

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