7

I'm starting to use Symfony Flex to bootstrap my project and I realized that running composer install for the first time generates a file named symfony.lock for which I could find no documentation.

What does this file do? Should I keep it in my version control and deploy it or should I .gitignore it?

Loupax
  • 4,728
  • 6
  • 41
  • 68

1 Answers1

12

Yes, officially you must add it to the version control:

Flex keeps tracks of the recipes it installed in the symfony.lock file, which must be committed to your code repository. https://symfony.com/doc/3.4/setup/flex#how-does-flex-work

Otherwise on staging or production stages it will be generated again by Flex, auto-configuring all installed packages with recipes and triggering bugs like this https://github.com/symfony/flex/issues/192

yceruto
  • 9,230
  • 5
  • 38
  • 65
  • 1
    We have our symfony.lock file in our version controler. However, composer install is actually updating symfony.lock file during every build. So, I am struggling to understand what benefit we get by keeping symfony.lock in version control. It is not being honored. – redusek Feb 16 '21 at 22:11