PHP Class Ergo\Routing\Router

Inheritance: implements Ergo\Routing\Controller
Exibir arquivo Open project: 99designs/ergo Class Usage Examples

Public Methods

Method Description
__construct ( $resolver = null ) Constructor
alias ( $template, $name, $to ) Register an alias from one route name to another
buildUrl ( string $name, array $parameters = [], $baseUrl = null ) Build a URL path based on a route name and associated parameters.
configure ( $file ) Configures the routemap from a php file
connect ( $template, $name, $controller = null, $metadata = [] ) Gives a route template a unique name and a controller to route to
controller ( $name ) Looks up a controller from a route name
execute ( $request ) * (non-phpdoc)
lookup ( string $path ) : RouteMatch Looks up a route match based on a url path
metadata ( $routeName ) : array Looks up metadata for a route name
redirect ( $template, $name, $to ) Create a redirect from a particular route name to another
routeByName ( $name ) : Route Looks up a route by name
setBaseUrl ( $url ) Sets a base url for url building
setDefaultMetadata ( $metadata ) Sets the default metadata to be set into routes

Private Methods

Method Description
_getRouteMatch ( string $path, array $routes ) : mixed Look for a matching route in provided route list.

Method Details

__construct() public method

Constructor
public __construct ( $resolver = null )

alias() public method

Register an alias from one route name to another
public alias ( $template, $name, $to )

buildUrl() public method

Build a URL path based on a route name and associated parameters.
public buildUrl ( string $name, array $parameters = [], $baseUrl = null )
$name string
$parameters array

configure() public method

Configures the routemap from a php file
public configure ( $file )

connect() public method

Gives a route template a unique name and a controller to route to
public connect ( $template, $name, $controller = null, $metadata = [] )

controller() public method

Looks up a controller from a route name
public controller ( $name )

execute() public method

* (non-phpdoc)
See also: Controller::execute()
public execute ( $request )

lookup() public method

Looks up a route match based on a url path
public lookup ( string $path ) : RouteMatch
$path string
return RouteMatch

metadata() public method

Looks up metadata for a route name
public metadata ( $routeName ) : array
return array

redirect() public method

Create a redirect from a particular route name to another
public redirect ( $template, $name, $to )

routeByName() public method

Looks up a route by name
public routeByName ( $name ) : Route
return Route

setBaseUrl() public method

Sets a base url for url building
public setBaseUrl ( $url )

setDefaultMetadata() public method

Sets the default metadata to be set into routes
public setDefaultMetadata ( $metadata )