nmb/twig-extensions-bundle

向 twig 添加一些函数和过滤器

安装: 15

依赖者: 0

建议者: 0

安全性: 0

星级: 0

关注者: 1

分支: 0

公开问题: 0

类型:symfony-bundle

1.0.0 2013-08-05 20:53 UTC

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') }}