Check Symfony Version

Check Symfony Version

When trying to solve bugs in application or installing PHP packages, is helpful to know which version of the Symfony framework you're using. This tutorial shows how to check Symfony version.

1. 'version' option

In Symfony 3 or newer versions, the bin/console command can be used with version option to determine version of Symfony.

php bin/console --version

Output example:

Symfony 6.0.6 (env: dev, debug: true)

In Symfony 2, use app/console command instead of bin/console.

php app/console --version

2. 'VERSION' constant

If you want to print Symfony version in the application, use the Kernel::VERSION constant.

test.php

<?php

use Symfony\Component\HttpKernel\Kernel;

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

echo Kernel::VERSION;

Leave a Comment

Cancel reply

Your email address will not be published.