• Fabien Potencier's avatar
    merged branch tiraeth/host (PR #648) · 0c3b670b
    Fabien Potencier authored
    This PR was squashed before being merged into the master branch (closes #648).
    
    Discussion
    ----------
    
    Added support for URL host from Routing Component
    
    Hi everyone,
    
    Firstly, I wanted to thank you all for Silex. It's fabulous.
    
    I needed URL host support in Silex to manage different subdomains of my small application and came up with an idea of introducing `->host($host)` chained method to `Silex\Route` class. This way users can apply host resolution to controllers in Silex.
    
    This PR includes above functionality + one unit test to check if everything works as expected.
    
    URL host support is of course available in Routing Component from version `>=2.2`, but Silex relies on 2.2 anyway.
    
    Example:
    ```php
    <?php
    
    // ...
    
    $app->match('/', function() {
        // app-specific action
    })->host('example.com');
    
    $app->match('/', function ($user) {
        // user-specific action
    })->host('{user}.example.com');
    
    // ...
    ```
    
    I am open for comments.
    
    Commits
    -------
    
    f0124c7f Added support for URL host from Routing Component
    0c3b670b
Name
Last commit
Last update
bin Loading commit data...
doc Loading commit data...
src/Silex Loading commit data...
tests Loading commit data...
.gitignore Loading commit data...
.travis.yml Loading commit data...
LICENSE Loading commit data...
README.md Loading commit data...
composer.json Loading commit data...
phpunit.xml.dist Loading commit data...