PHP Class lithium\console\command\Route

Inheritance: extends lithium\console\Command
Show file Open project: unionofrad/lithium Class Usage Examples

Public Properties

Property Type Description
$env string For example: sh li3 route --env=production li3 route show /foo --env=test

Public Methods

Method Description
__construct ( array $config = [] ) Constructor. Load the routes file and set the environment.
all ( $scope = true ) : void Lists all connected routes to the router. This is a convenience alias for the show() method.
run ( ) : void Lists all connected routes to the router. See the all() method for details and examples.
show ( ) : void Returns the corresponding params for a given URL and an optional request method.

Protected Methods

Method Description
_init ( )

Method Details

__construct() public method

Constructor. Load the routes file and set the environment.
public __construct ( array $config = [] )
$config array The default configuration, wherein the absolute path to the routes file to load may be specified, using the `'routes'` key.

_init() protected method

protected _init ( )

all() public method

Example: sh li3 route li3 route all Will return an output similar to: Template Params -------- ------ {"controller":"pages","action":"view"} pages/{:args} {"controller":"pages","action":"view"} {:slug:[\w\-]+} {"controller":"posts","action":"show"} {:controller}/{:action}/{:args} {"action":"index"}
public all ( $scope = true ) : void
return void

run() public method

Lists all connected routes to the router. See the all() method for details and examples.
public run ( ) : void
return void

show() public method

Examples: 1: li3 route show /foo 2: li3 route show post /foo/bar/1 3: li3 route show /test 4: li3 route show /test --env=production Will return outputs similar to: 1: {"controller":"foo","action":"index" } 2: {"controller":"foo","action":"bar","args":["1"]} 3: {"controller":"lithium\\test\\Controller","action":"index"} 4: {"controller":"test","action":"index"}
public show ( ) : void
return void

Property Details

$env public property

For example: sh li3 route --env=production li3 route show /foo --env=test
public string $env
return string