0

I have a running project with Symfony 2 and I want to control versions using Git. It would be very nice if I can version the bundle I'm working on right now and include it as vendor.

In the end, I would have an empty Symfony project and everything is running in the vendors and all updates are done via Composer.

Is this possible?

I know the question is not very detailed but this is the best I can do. Should you have any question, please comment!

Aysennoussi
  • 3,720
  • 3
  • 36
  • 60
  • possible duplicate of [Symfony2 - creating own vendor bundle - project and git strategy](http://stackoverflow.com/questions/21523481/symfony2-creating-own-vendor-bundle-project-and-git-strategy) – acrobat Jun 23 '14 at 14:46
  • Hello Acrobat , thanks for the link – Aysennoussi Jun 23 '14 at 14:51

1 Answers1

1

Composer writes the exact versions being used into the file composer.lock, and will restore the result recorded there whenever you run composer install.

So the usual workflow would be to create the repository for your application, add a composer.json, add your dependencies including their version requirements into that file, and run composer update.

Then commit both composer files composer.json and composer.lock, but ignore the created vendor directory. That way you should be able to restore this committed situation any time later by simply checking out this commit and again run composer install.

You can add the call to composer install as a post-checkout command in your git repository to automatically switch the committed dependencies.

Sven
  • 69,403
  • 10
  • 107
  • 109