Adds new features to TuTu twig templates engine.

Adds new features to TuTu twig templates engine.

README

This extensions adds new features to Twig

To use extension simply add it to TuTu composer dependencies:

$ composer require coduo/tutu-twig-extension

Enable extension in TuTu configuration

# config/config.yml

extensions:
    CoduoTuTuExtensionTwig: ~

From now you should be able to use following features in twig:

Filters

json_decode – decode json into array/object

Arguments

  • $asArray – true
  • $depth – 512

Examples

{% set user = request.content|json_decode %}
{
    "id": 1,
    "email": {{ user.name }}
}

Source

Add a Comment

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *