nmb / twig-extensions-bundle
向 twig 添加一些函数和过滤器
1.0.0
2013-08-05 20:53 UTC
Requires
- php: >=5.3.2
- symfony/symfony: >=2.0,<=2.4.0
This package is not auto-updated.
Last update: 2024-09-23 15:10:22 UTC
README
我想要在我的 symfony 项目中使用的某些 Twig 函数和过滤器
安装
将 NmbTwigExtensionsBundle 添加到你的 composer.json
{ "require": { "nmb/twig-extensions-bundle": "dev-master" } }
运行命令下载该组件
$php composer.phar update nmb/twig-extensions-bundle
将组件添加到你的 app/AppKernel.php
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Nmb\TwigExtensionsBundle\NmbTwigExtensionsBundle(), ); }
用法
在你的 twig 模板中
{{ getParameter('my_parameter') }}