Check Twig Version in Symfony

Check Twig Version in Symfony

Finding out which version of the Twig you have installed in Symfony framework can be useful when solving bugs or installing packages. This tutorial shows how to check Twig version in Symfony.

We can use the Environment::VERSION constant to determine Twig version.

test.php

<?php

use Twig\Environment;

require_once __DIR__.'/vendor/autoload.php';

echo Environment::VERSION;

This constant can be used in the template as follows:

templates/test/index.html.twig

{{ constant('Twig\\Environment::VERSION') }}

Leave a Comment

Cancel reply

Your email address will not be published.