mikeyismint / fruit
该包的最新版本(dev-master)没有可用的许可证信息。
dev-master
2017-04-07 21:40 UTC
Requires
- php: >=5.3.0
Requires (Dev)
- phpunit/phpunit: ~4.5
This package is not auto-updated.
Last update: 2024-09-28 17:43:46 UTC
README
我的第一个简单的PHP路由器尝试。受到了AltoRouter的影响
使用方法
$router = new Fruit(); // map single route $router->addRoute('GET', '/', 'Controller#Method'); // map post details page $router->addRoute('GET', '/^posts\/id\/(?P<id>\d+)$/', 'Controller#Method'); // map multiple routes $router->addRoutes(array( array('GET', '/', 'Controller#Method'), array('GET', '/^posts\/id\/(?P<id>\d+)$/', 'Controller#Method'), ));
其他功能
- 接受多个通过
|
分隔的HTTP方法 - 使用正则表达式匹配URL模式
- 接受可选的第四个参数来命名路由