How to know which version of Symfony I have?

前端 未结 11 1634
执念已碎
执念已碎 2020-12-07 19:35

I know that I have downloaded a Symfony2 project and started with but I have updated my vendor several times and I want to know which version of symfony I have

相关标签:
11条回答
  • 2020-12-07 20:13

    if you are in app_dev, you can find symfony version at the bottom left corner of the page

    0 讨论(0)
  • 2020-12-07 20:18

    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.

    0 讨论(0)
  • 2020-12-07 20:19

    if you trying with version symfony

    please try with

    symfony 2 +

    cmd>php app/console --version

    symfony 3+

    cmd>php bin/console --version

    for example

    D:project>php bin/console --version

    Symfony 3.2.8 (kernel: app, env: dev, debug: true)
    
    0 讨论(0)
  • 2020-12-07 20:21

    also you can check the version of symfony and versions of all other installed packages by running

    composer show
    

    or

    composer show | grep sonata
    

    to get versions of specific packages like sonata etc.

    0 讨论(0)
  • 2020-12-07 20:25

    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.

    0 讨论(0)
提交回复
热议问题