2017 © Pedro Peláez
 

symfony-bundle twig-callable-bridge-bundle

Provides a simple interface to extend Twig with PHP functions

image

covex-nn/twig-callable-bridge-bundle

Provides a simple interface to extend Twig with PHP functions

  • Friday, July 8, 2016
  • by covex-nn
  • Repository
  • 1 Watchers
  • 0 Stars
  • 356 Installations
  • PHP
  • 6 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Twig Callable Bridge Bundle

Build Status SensioLabsInsight, (*1)

This Symfony2 bundle aims to provide a simple interface to extend Twig with PHP functions, (*2)

Installation

Add requirements to composer.json:, (*3)

``` json { "require" : { "covex-nn/twig-callable-bridge-bundle" : "~1.0" } }, (*4)


Register the bundle ------------------- Register the bundle in the `AppKernel.php` file ``` php // ...other bundles ... $bundles[] = new Covex\TwigCallableBridgeBundle\CovexTwigCallableBridgeBundle();

Configuration

Add the configuration to config.yml, (*5)

``` yaml covex_twig_callable_bridge: functions: uppercase: strtoupper filters: lowercase: strtolower test: numeric: is_numeric, (*6)


Twig ---- Use your functions, filters and test in Twig templates: ``` twig {{ uppercase('qqq') }} {{ 'WoW'|lowercase }} {% if 1 is numeric %}yes{% else %}no{% endif %}

The Versions