Silex Router Provider
, (*1)
Define routes for application with YAML files., (*2)
Install
composer require mrprompt/silex-router-provider
Usage
use SilexFriends\Router\Router as RouterServiceProvider;
$app->register(new RouterServiceProvider(__DIR__ . DS . 'config' . DS . 'routes' . DS . 'routes.yml'));
Configuration files, (*3)
# routes.yml
# http://symfony.com/doc/current/components/routing/introduction.html
home:
path: /
defaults: { _controller: 'Controller\Home::get' }
methods: [GET]
user:
prefix: /user
resource: routes.user.yml
# routes.user.yml
# http://symfony.com/doc/current/components/routing/introduction.html
user.home:
path: /
defaults: { _controller: 'Controller\User::get' }
methods: [GET]
Testing
Just run phpunit without parameters, (*4)
phpunit