PHP Class ManaPHP\Mvc\Router

Inheritance: extends ManaPHP\Component, implements ManaPHP\Mvc\RouterInterface
Show file Open project: manaphp/manaphp

Protected Properties

Property Type Description
$_action string
$_controller string
$_groups array
$_module string
$_modules array
$_params array
$_removeExtraSlashes boolean
$_wasMatched boolean

Public Methods

Method Description
getActionName ( ) : string Returns the processed action name
getControllerName ( ) : string Returns the processed controller name
getModuleName ( ) : string Returns the processed module name
getModules ( ) : array
getParams ( ) : array Returns the processed parameters
getRewriteUri ( ) : string Get rewrite info. This info is read from $_GET['_url'] or _SERVER["REQUEST_URI"].
handle ( string $uri = null, string $host = null, boolean $silent = true ) : boolean Handles routing information received from the rewrite engine
mount ( string | ManaPHP\Mvc\Router\GroupInterface $group, string $path = null ) : static Mounts a group of routes in the router
removeExtraSlashes ( boolean $remove ) : static Set whether router must remove the extra slashes in the handled routes
wasMatched ( ) : boolean Checks if the router matches any of the defined routes

Method Details

getActionName() public method

Returns the processed action name
public getActionName ( ) : string
return string

getControllerName() public method

Returns the processed controller name
public getControllerName ( ) : string
return string

getModuleName() public method

Returns the processed module name
public getModuleName ( ) : string
return string

getModules() public method

public getModules ( ) : array
return array

getParams() public method

Returns the processed parameters
public getParams ( ) : array
return array

getRewriteUri() public method

Get rewrite info. This info is read from $_GET['_url'] or _SERVER["REQUEST_URI"].
public getRewriteUri ( ) : string
return string

handle() public method

Read the info from the rewrite engine $router->handle(); Manually passing an URL $router->handle('/posts/edit/1');
public handle ( string $uri = null, string $host = null, boolean $silent = true ) : boolean
$uri string
$host string
$silent boolean
return boolean

mount() public method

Mounts a group of routes in the router
public mount ( string | ManaPHP\Mvc\Router\GroupInterface $group, string $path = null ) : static
$group string | ManaPHP\Mvc\Router\GroupInterface
$path string
return static

removeExtraSlashes() public method

Set whether router must remove the extra slashes in the handled routes
public removeExtraSlashes ( boolean $remove ) : static
$remove boolean
return static

wasMatched() public method

Checks if the router matches any of the defined routes
public wasMatched ( ) : boolean
return boolean

Property Details

$_action protected property

protected string $_action
return string

$_controller protected property

protected string $_controller
return string

$_groups protected property

protected array $_groups
return array

$_module protected property

protected string $_module
return string

$_modules protected property

protected array $_modules
return array

$_params protected property

protected array $_params
return array

$_removeExtraSlashes protected property

protected bool $_removeExtraSlashes
return boolean

$_wasMatched protected property

protected bool $_wasMatched
return boolean