Symfony2 version switch

114 views Asked by At

Can I somehow detect inside the code which version of symfony is currently used?
I have a bundle which uses a symfony function that has changed in version 2.4 so I need to detect on which version I am running, so that the function which is adequate for the used symfony version will be called

1

There are 1 answers

3
Jens A. Koch On

The symfony version constant will help you.

You find it in Symfony/Component/HttpKernel/Kernel - constant VERSION.

https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Kernel.php#L62