Skip to content
This repository has been archived by the owner on Aug 21, 2019. It is now read-only.
/ Silex-Routing Public archive

Silex-Routing provides advanced routing for Silex through connecting symfony-cmf/Routing with Silex.

License

Notifications You must be signed in to change notification settings

chili-labs/Silex-Routing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Silex-Routing

Serviceprovider for advanced and dynamic routing in Silex

Latest Stable Version Total Downloads License Build Status Coverage Status SensioLabsInsight

Description

Silex-Routing allows you to define custom and multiple routers for Silex. This is especially useful when working with dynamic routes, which are not known while writing the code (e.g. URLs stored in database).

This implementation works for both, matching and generating of URLs.

The advanced routing is achieved by connecting Silex with symfony-cmf/Routing.

Installation

The recommended way to install Silex-Routing is through composer. Just create a composer.json file and run the php composer.phar install command to install it:

{
    "require": {
        "project-a/silex-routing": "dev-master"
    }
}

Alternatively, you can download the silexrouting.zip file and extract it.

Upgrade from 1.0 to 2.0

Version 2 is not backward compatible with version 1. Make sure to carefully read the changelog.

Usage

Using Silex-Routing is very simple. All you need to do is register the provided RoutingServiceProvider and afterwards add all your custom routers (RouterInterface).

$app = new \Silex\Application();
$app->register(new \ChiliLabs\Silex\Provider\RoutingServiceProvider());

$router2 = new \Acme\Silex\MySpecialRouter();
$app['routers']->add($router);
...

There is a router in this repository named SilexRouter, that handles the default routing behavior of Silex. Registering this router ensures, that all routes added through the main Silex application still work. (This router is not registered by default.)

Since version 2.0 of project-a/silex-routing the url generation is included in the RoutingServiceProvider and no special UrlGeneratorServiceProvider is needed anymore.

Tests

To run the test suite, you need composer.

$ php composer.phar install --dev
$ phpunit

License

Silex-Routing is licensed under the MIT license.

About

Silex-Routing provides advanced routing for Silex through connecting symfony-cmf/Routing with Silex.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages