opsbears/piccolo-web-router-fastroute

This package is abandoned and no longer maintained. No replacement package was suggested.

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

This is a Piccolo module for nikics FastRoute library available here: https://github.com/nikic/FastRoute

Installation

Installation can be required via composer:

composer require opsbears/piccolo-router-fastroute

You will then need to add it to the modules list in your configuration:

'modules' => [
    //...
    FastRouteModule::class,
    //...
]

Configuration

The configuration is consumed by FastRouteModule and requires the following options to be set:

'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'],
    ],
]

For more details please see the documentation of FastRoute.

License

Like all Piccolo modules, the FastRoute module is available under the MIT license. The FastRoute library itself is available under the BSD-3-Clause license.