The general recommendation is no. The vendor directory (or wherever your
dependencies are installed) should be added to .gitignore
/svn:ignore
/etc.
The best practice is to then have all the developers use Composer to install the dependencies. Similarly, the build server, CI, deployment tools etc should be adapted to run Composer as part of their project bootstrapping.
While it can be tempting to commit it in some environment, it leads to a few problems:
If you really feel like you must do this, you have a few options:
preferred-install
to dist
in your
config..git
directory of every dependency after the installation, then
you can add them to your git repo. You can do that with rm -rf vendor/**/.git
in ZSH or find vendor/ -type d -name ".git" -exec rm -rf {} \;
in Bash.
but this means you will have to delete those dependencies from disk before
running composer update./vendor/**/.git
) to ignore all the vendor .git
folders.
This approach does not require that you delete dependencies from disk prior to
running a composer update.