Check Symfony Version

Check Symfony Version

When trying to solve bugs in an application or installing PHP packages, it 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 the version of Symfony.

php bin/console --version

Output example:

Symfony 7.0.1 (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.