fabpot/Silex — pull request #377 by fabpot (2012-06-17 15:24:40+00:00)
Title: PHP 5.4 traits

This is a first attempt to provide useful shortcut methods on the Application class via traits. It also contains a `secure` method for routes.

Here is how you can make use of these features on PHP 5.4:

class MyApp extends Application
{
use Application\TwigTrait;
use Application\SecurityTrait;
use Application\FormTrait;
use Application\UrlGeneratorTrait;
use Application\SwiftmailerTrait;
use Application\MonologTrait;
use Application\TranslationTrait;
}

class MyRoute extends Route
{
use Route\SecurityTrait;
}

$app = new MyApp();
$app['route_factory'] = function () use ($app) {
return new MyRoute();
};