Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know which version of Symfony I have?

Tags:

php

symfony

People also ask

What is the difference between Symfony 4 and 5?

The differences are mainly two: On the one hand, Symfony 4.4 becomes the LTS (long term support) version thus replacing the old version 3.4. On the other hand, Symfony 5 is practically the same as Symfony 4.4 unless it does not have the code that has been marked as deprecated in version 4.4.

What is Symfony PHP framework?

Symfony is a set of PHP Components, a Web Application framework, a Philosophy, and a Community — all working together in harmony.

How do I open Symfony?

Running your Symfony ApplicationOpen your browser and navigate to http://localhost:8000/ . If everything is working, you'll see a welcome page. Later, when you are finished working, stop the server by pressing Ctrl+C from your terminal.

What is Symfony PHP developer?

Symfony is an internationally recognized, stable development environment. An innovative and easy-to-use work environment thanks to integrating solutions created in other environments such as dependency injection (taken from Java) and specifically developed solutions such as the Web Debug Toolbar or the Web Profiler.


Run app/console --version (for Symfony3: bin/console --version), it should give you a pretty good idea. On a random project of mine, the output is:

Symfony version 2.2.0-DEV - app/dev/debug

If you can't access the console, try reading symfony/src/Symfony/Component/HttpKernel/Kernel.php, where the version is hardcoded, for instance:

const VERSION         = '2.2.0';

Just in case you are wondering, console creates an instance of Symfony\Bundle\FrameworkBundle\Console\Application. In this class constructor, it uses Symfony\Component\HttpKernel\Kernel::VERSION to initialize its parent constructor.


Although there are already many good answers I'd like to add an option that hasn't been mentioned. Using the command:

php bin/console about

you can get many details about the current project. The first section is about Symfony itself and looks like this:

-------------------- ------------------------------------------- 
 Symfony                                                         
-------------------- ------------------------------------------- 
 Version              4.2.3                                      
 End of maintenance   07/2019                                    
 End of life          01/2020                                    
-------------------- ------------------------------------------- 

I find the other information besides the version number very useful.

There are also other sections providing details about the (framework) Kernel, PHP, Environment.


Another way is to look at the source for Symfony\Component\HttpKernel\Kernel for where const VERSION is defined. Example on GitHub

Locally this would be located in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php.


Use the following command in your Terminal/Command Prompt:

php bin/console --version

This will give you your Symfony Version.