mrprompt/silex-router-provider

A simple router provider to Silex with YAML

dev-master 2016-10-21 14:28 UTC

This package is auto-updated.

Last update: 2024-04-21 05:31:43 UTC


README

Build Status Code Climate Test Coverage Issue Count SensioLabsInsight Dependency Status Codacy Badge

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