nigelgreenway/route-generator-plugin

A route generation plugin for the League/Route package

dev-master 2015-07-03 13:07 UTC

This package is auto-updated.

Last update: 2024-11-27 16:30:59 UTC


README

A route generation plugin for the League/Route package.

Install

Via Composer

$ composer require league/route-generator-plugin

Usage

$generator = new Route\Generator\RouteGenerator([
    'hello_module' => [
        'hello_world' => [
            'pattern'    => '/hello/world',
            'controller' => function() {
                echo 'Hello world.';
            },
            'method'     => ['GET'],
        ],
        'hello_person' => [
            'pattern'    => '/hello/{name}',
            'controller' => function($name) {
                echo 'Hello '.$name;
            }
        ],
    ],
]);
echo $generator->generate('hello_word');
// /hello/world

echo $generator->generate('hello_person', ['name' => 'Timmy Mallet']);
// /hello/Timmy+Mallet

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer tests

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email nigel_greenway@me.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.