Provides a way to display Twig PHP variables in a pretty way.

Twig VarDumper provides a better {{ dump() }} and {{ vardumper() }} function that can help you debug Twig variables.

API functions

  • {{ dump() }} Show all variables y current template. Replaced default {{ dump() }} from Twig Debug.php using symfony/var-dumper
  • {{ dump(variable_name) }} Show current variable informartion using symfony/var-dumper
  • {{ vardumper() }} Show all variables y current template using symfony/var-dumper
  • {{ vardumper(variable_name) }} Show current variable informartion using symfony/var-dumper

INSTALLATION

On Drupal 11.x.x, install the module using CLI:

  1. Require and install the module and its dependencies
    • composer config repositories.drupal composer https://packages.drupal.org/11
    • composer require drupal/twig_vardumper:^3

Configure Drupal to work

  1. Set development environment for twig
    • Uncomnet in settings.local.php file $settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml'; line
    • Add in development.services.yml
    • parameters:
      twig.config:
      debug: true

DEMO

Twig_Vardumper by Amber Matz

Supporting organizations: 

Project information

Releases