$routes
$routes : array
Array of available routes
Pop router class
$routeMatch : \Pop\Router\Match\MatchInterface
Route match object
$controller : \Pop\Controller\ControllerInterface
Controller object
__construct(array $routes = null) : \Pop\Router\Router
Constructor
Instantiate the router object
array | $routes |
addRoute(string $route, mixed $controller) : \Pop\Router\Router
Add a route
string | $route | |
mixed | $controller |
addRoutes(array $routes) : \Pop\Router\Router
Add multiple controller routes
array | $routes |
addControllerParams(string $controller, mixed $params = null) : \Pop\Router\Router
Add controller params to be passed into a new controller instance
$router->addControllerParams('MyApp\Controller\IndexController', ['foo', 'bar']);
string | $controller | |
mixed | $params |
addDispatchParams(string $dispatch, mixed $params) : \Pop\Router\Router
Add dispatch params to be passed into the dispatched method of the controller instance
$router->addDispatchParams('MyApp\Controller\IndexController->foo', ['bar', 'baz']);
string | $dispatch | |
mixed | $params |
getRouteMatch() : \Pop\Router\Match\MatchInterface
Get route match object
getController() : \Pop\Controller\ControllerInterface
Get the current controller object
match() : \Pop\Router\Router
Execute the route match