class Router extends Component

Properties

ContainerInterface $container from Component
EventManagerInterface $eventManager from Component

Methods

setContainer(ContainerInterface $container)

设置依赖注入容器

from Component
getContainer()

No description

from Component
setEventManager(EventManagerInterface $eventManager)

设置事件管理器

from Component
mixed
trigger(string|EventInterface $event, mixed $data = null)

触发事件

from Component
__get(string $name)

获取容器本身,或者获取容器中的某个服务

from Component
map(string|string[] $methods, string $pattern, array $handler)

Add route.

get($pattern, $handler)

No description

post($pattern, $handler)

No description

put($pattern, $handler)

No description

delete($pattern, $handler)

No description

head($pattern, $handler)

No description

trace($pattern, $handler)

No description

options($pattern, $handler)

No description

setDefaults(array $defaults)

No description

getNamespaceName()

No description

getControllerName()

No description

getActionName()

No description

getParams()

No description

handle(string $uri = null)

No description

Details

in Component at line 33
setContainer(ContainerInterface $container)

设置依赖注入容器

Parameters

ContainerInterface $container 容器对象实例

in Component at line 41
ContainerInterface getContainer()

Return Value

ContainerInterface

in Component at line 49
setEventManager(EventManagerInterface $eventManager)

设置事件管理器

Parameters

EventManagerInterface $eventManager

in Component at line 57
EventManagerInterface getEventManager()

Return Value

EventManagerInterface

in Component at line 77
mixed trigger(string|EventInterface $event, mixed $data = null)

触发事件

$this->trigger('dispatch.beforeDispatchLoop', $data);

$event = new Event('application.boot', $data);
$this->trigger($event);

Parameters

string|EventInterface $event 事件名称或事件对象实例
mixed $data 事件相关数据

Return Value

mixed

in Component at line 88
ContainerInterface|mixed __get(string $name)

获取容器本身,或者获取容器中的某个服务

Parameters

string $name

Return Value

ContainerInterface|mixed

at line 36
map(string|string[] $methods, string $pattern, array $handler)

Add route.

Parameters

string|string[] $methods 'GET' or ['GET', 'POST']
string $pattern
array $handler

at line 45
get($pattern, $handler)

Parameters

$pattern
$handler

at line 50
post($pattern, $handler)

Parameters

$pattern
$handler

at line 55
put($pattern, $handler)

Parameters

$pattern
$handler

at line 60
delete($pattern, $handler)

Parameters

$pattern
$handler

at line 65
head($pattern, $handler)

Parameters

$pattern
$handler

at line 70
trace($pattern, $handler)

Parameters

$pattern
$handler

at line 75
options($pattern, $handler)

Parameters

$pattern
$handler

at line 80
setDefaults(array $defaults)

Parameters

array $defaults

at line 98
getNamespaceName()

at line 103
getControllerName()

at line 108
getActionName()

at line 113
getParams()

at line 121
handle(string $uri = null)

Parameters

string $uri