jake-fr/twig-set
Composer 安装命令:
composer require jake-fr/twig-set
包简介
Set tag for twig with support of combined operators
关键字:
README 文档
README
set tag for twig 2 with support of combined operators.
Requirements
This librairy requires Twig 2 and PHP 7
Installation
Install via Composer
$ composer require jake-fr/twig-set
Add the extension to twig
The constructor expects one parameter:
An array of supported binary nodes with symbol as key and the binary node class name as value.
$operators = [ '+' => 'Twig_Node_Expression_Binary_Add', '-' => 'Twig_Node_Expression_Binary_Sub', '~' => 'Twig_Node_Expression_Binary_Concat', '*' => 'Twig_Node_Expression_Binary_Mul', '/' => 'Twig_Node_Expression_Binary_Div', '//' => 'Twig_Node_Expression_Binary_FloorDiv', '%' => 'Twig_Node_Expression_Binary_Mod', '**' => 'Twig_Node_Expression_Binary_Power', ]; $twig->addExtension(new \JakeFr\TwigSet\Extension($operators));
Usage
{% set foo = 4 %} {{ foo }} {# will ouput 4 #} {% set foo += 3 %} {{ foo }} {# will ouput 7 #}
统计信息
- 总下载量: 14
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-01-18