opsbears/piccolo-web-router-fastroute

此包已被废弃,不再维护。未建议替代包。

1.0-alpha1 2016-07-22 07:14 UTC

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许可证下提供。