phpalchemy/routing
Composer 安装命令:
composer require phpalchemy/routing
包简介
PHP Alchemy Routing Component
关键字:
README 文档
README
Faster & simple Http Routing
This is a Simple but faster URL Http routing library
Sample Use:
use Alchemy\Component\Routing\Mapper;
use Alchemy\Component\Routing\Route;
$mapper = new Mapper();
$mapper->connect(
'home_route',
new Route(
'/',
array(
'_controller' => 'sample',
'_action' => 'index'
)
)
);
$mapper->connect(
'to_index_route',
new Route(
'/{_controller}',
array('_action' => 'index')
)
);
$mapper->connect(
'complete_route',
new Route(
'/{_controller}/{_action}'
)
);
$mapper->connect(
'complete_route',
new Route(
'/leap_year/{year}', // pattern
array( // defaults
'_controller' => 'Validator',
'_action' => 'leapYear'
),
array( // requeriments
'year' => '\d+',
'_method' => array('GET', 'POST')
)
)
);
print_r($mapper->match('/home/sample'));
Array
(
[_controller] => home,
[_action] => sample
)
print_r($mapper->match('/leap_year/2012'));
Array
(
[_controller] => Validator,
[_action] => leapYear,
[year] => 2012,
)
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-09-03