dev-master
9999999-dev https://github.com/wake/Twig-TraitProvide TwigTrait for Silex. This is base on Silex/Application/TwigTrait.php by Fabien Potencier and add some helpful functions.
MIT
The Requires
by Wake Liu
twig silex
Provide TwigTrait for Silex. This is base on Silex/Application/TwigTrait.php by Fabien Potencier and add some helpful functions.
Provide a better way to use Twig with Silex, base on Silex/Application/TwigTrait.php by Fabien Potencier., (*1)
$app->get('/hello/{name}', function ($name) use ($app) { // Original way /* return $app->render ('hello.twig', [ 'name' => $name, ]); */ // A better way return $app ->assign ('name', $name) ->render ('hello.twig'); // Or $app->assign ('name', $name); // some code // ... return $app->render ('hello.twig'); });
Add in your composer.json
with following require entry:, (*2)
{ "require": { "wake/Silex-Twig-Helper": "*" } }
or using composer:, (*3)
$ composer require wake/Silex-Twig-Helper:*
then run composer install
or composer update
., (*4)
class MyApplication extends Silex\Application { use Silex\Application\TwigHelperTrait; }
Please feel free to open an issue and let me know if there is any thoughts or questions :smiley:, (*5)
Released under the MIT license, (*6)
Provide TwigTrait for Silex. This is base on Silex/Application/TwigTrait.php by Fabien Potencier and add some helpful functions.
MIT
twig silex