2017 © Pedro Peláez
 

library twig-set

Set tag for twig with support of combined operators

image

jake-fr/twig-set

Set tag for twig with support of combined operators

  • Wednesday, January 18, 2017
  • by JakeFr
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

JakeFR / TwigSet

set tag for twig 2 with support of combined operators., (*1)

Requirements

This librairy requires Twig 2 and PHP 7, (*2)

Installation

Install via Composer, (*3)

``` bash $ composer require jake-fr/twig-set, (*4)


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. ``` php $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

``` jinja {% set foo = 4 %}, (*5)

{{ foo }} {# will ouput 4 #}, (*6)

{% set foo += 3 %}, (*7)

{{ foo }} {# will ouput 7 #} ```, (*8)

The Versions

18/01 2017

dev-master

9999999-dev

Set tag for twig with support of combined operators

  Sources   Download

MIT

The Requires

 

twig

18/01 2017

v0.1.1

0.1.1.0

Set tag for twig with support of combined operators

  Sources   Download

MIT

The Requires

 

twig

18/01 2017

v0.1.0

0.1.0.0

Set tag for twig with support of combined operators

  Sources   Download

MIT

The Requires

 

twig