fabpot/Silex — pull request #648 by tiraeth (2013-03-08 18:45:56+00:00)
Title: 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
match('/', function() {
// app-specific action
})->host('example.com');

$app->match('/', function ($user) {
// user-specific action
})->host('{user}.example.com');

// ...
```

I am open for comments.