mrprompt / silex-router-provider
A simple router provider to Silex with YAML
dev-master
2016-10-21 14:28 UTC
Requires
- php: >=5.5
- symfony/config: ~2.6
Requires (Dev)
- codeclimate/php-test-reporter: dev-master
- phpunit/phpunit: ^4.8
- silex/silex: 1.*@dev
This package is auto-updated.
Last update: 2024-11-21 06:46:30 UTC
README
Define routes for application with YAML files.
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
# 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
phpunit