opsbears / piccolo-web-router-fastroute
此包已被废弃,不再维护。未建议替代包。
1.0-alpha1
2016-07-22 07:14 UTC
Requires
- php: ^7.0
- nikic/fast-route: ^1.0
- opsbears/piccolo: ^1.0
- opsbears/piccolo-web: ^1.0
Requires (Dev)
- guzzlehttp/psr7: ^1.3
- opsbears/piccolo-dev-tools: ^1.0
- opsbears/piccolo-dic-auryn: ^1.0
Provides
- opsbears/piccolo-web-router: 1.0.0
This package is not auto-updated.
Last update: 2020-08-19 07:07:59 UTC
README
这是一个Piccolo模块,用于nikics FastRoute库,可在以下地址找到:https://github.com/nikic/FastRoute
安装
可以通过composer进行安装
composer require opsbears/piccolo-router-fastroute
然后需要将其添加到您配置中的模块列表
'modules' => [
//...
FastRouteModule::class,
//...
]
配置
配置由FastRouteModule消耗,需要设置以下选项
'fastroute' => [
'errorHandlers' => [
404 => [ErrorController::class, 'notFound'],
405 => [ErrorController::class, 'methodNotAllowed'],
500 => [ErrorController::class, 'error'],
],
'routes' => [
['GET', '/', BlogController::class, 'indexAction'],
['GET', '/{slug:[a-zA-Z\-]+}', BlogController::class, 'postAction'],
],
]
更多详细信息请参阅FastRoute的文档。
许可证
与所有Piccolo模块一样,FastRoute模块在MIT许可证下提供。FastRoute库本身在BSD-3-Clause许可证下提供。