\Nano4\PluginsRouter

Routing Dispatcher.

Matches routes based on rules. Inspired by Webtoo (w/Router::Simple) and PHP-Router.

TODO: more logging/debugging.

Summary

Methods
Properties
Constants
known_routes()
__construct()
base_uri()
auto_prefix()
add()
setDefault()
redirect()
display()
match()
route()
build()
go()
has()
get_route()
$base_uri
$log
$debug
$default_filter
$current
No constants found
No protected methods found
$routes
$named
$default
N/A
No private methods found
No private properties found
N/A

Properties

$base_uri

$base_uri : 

Type

$log

$log : 

Type

$debug

$debug : 

Type

$default_filter

$default_filter : 

Type

$current

$current : 

Type

$routes

$routes : 

Type

$named

$named : 

Type

$default

$default : 

Type

Methods

known_routes()

known_routes() 

__construct()

__construct(  $opts = array()) 

Parameters

$opts

base_uri()

base_uri(  $newval = Null) 

Set the base_uri.

Parameters

$newval

auto_prefix()

auto_prefix() 

Automatically set the URL prefix based on our SCRIPT_NAME.

add()

add(  $route,   $is_default = False,   $add_it = True) 

Add a route

Parameters

$route
$is_default
$add_it

setDefault()

setDefault(  $route) 

Set a default controller. This will not be checked in the normal route test, and will only be used if no other routes matched.

Parameters

$route

redirect()

redirect(  $from_uri,   $to_uri,   $opts = array()) 

Add a redirect rule.

Parameters

$from_uri
$to_uri
$opts

display()

display(  $path,   $view,   $is_default = False) 

Display a view without an underlying controller.

Parameters

$path
$view
$is_default

match()

match(  $uri = Null,   $method = Null) 

See if we can match a route against a URI and method.

Returns a RouteContext object.

If there is no default controller specified, and no route matches, it will return Null.

Parameters

$uri
$method

route()

route(  $uri = Null,   $method = Null) 

The primary frontend function for starting the routing.

Parameters

$uri
$method

build()

build(  $routeName,   $params = array(),   $opts = array()) 

Build a URI for a named route.

Parameters

$routeName
$params
$opts

go()

go(  $routeName,   $params = array(),   $ropts = array(),   $bopts = array()) 

Redirect the browser to a known route, with the appropriate parameters.

Parameters

$routeName
$params
$ropts
$bopts

has()

has(  $routeName) 

Check to see if we know about a named route.

Parameters

$routeName

get_route()

get_route(  $routeName) 

Get a named route.

Parameters

$routeName