Reputation: 29
I'm already half way done with a project in Symfony2.
I need to install a couple of new vendor bundles using composer.
I already have everything (minus logs, cache and parameters.yml) in version control (including the vendor folder).
Problem is when using composer update, it deletes the .svn folders in the vendor folders that where updated. So it's basically impossible to commit now (gives me not a working copy error).
Additional information: I'm working locally and committing to a dev server and then once approved an application server. Therefore it has to be perfect (cannot just run php composer install or php composer update on the dev/application server after commit).
I also tried exporting everything and copying and pasting them back into the repo but that also didn't work (index page broke locally).
Upvotes: 2
Views: 777
Reputation: 11364
Regarding to vendor versioning the best way is not version vendors at all.
The only things you need to version are composer.json
and composer.lock
. This may cause a problem with vendors which doesn't have stable versions or with that for which you need not stable one (eg. master with particular commit).
As a solution you should create your own (private) vendor repository (let's say your own packagist). Composer has a tool for that, which is called Satis.
https://github.com/composer/satis
So my suggestion would be:
satis.json
and whenever you need to update a version of vendor, or add new one, you only modify satis.json and rebuild repository.composer.json
you set your new private repository as the only repository and set option: packagist
to false
.composer install
it will use only your private repository, so it's fast and you always sure that every environemnt has the same versions-
Upvotes: 1
Reputation: 2488
Including vendor packages in your codebase is not recommended, so if you need to maintain the same version of the packages you use on your local machine, the best way is to keep composer.lock in the VCS and running only composer install on other environments.
Additionally, if you want the prod deployment to be instant, without depending on the composer process, you could run composer install on the dev server, and once it's validated you can make your prod deployment script copy the vendor folder from the dev env.
Upvotes: 0
Reputation: 10890
You should not keep your vendor
directory in your version control. This is how it is done in Symfony Standard Edition and you should follow this. Running composer install
command should be a part of your deployment process
Upvotes: 0
Reputation: 20193
I was in similar situation two years ago.
The hard lesson I learned was never to edit files within vendor. At first I totally rejected using composer
and manually cloned everything I needed. Later on, I decided to fork projects I needed to edit and referenced my forks instead.
Composer supports private GitHub repos - you don't need to register it to Packagist in order to work.
Upvotes: 0