Question

In my web app I've successfully installed several PHP Github repositories using Composer. The most recent one I installed on my localhost (using php composer.phar update blahblah/blahblah) works great just like all the others. However, when I git pushed my app to my live site, the blahblah/blahblah directory was empty.

I believe this is a Git issue and that my localhost has the blahblah master repo which isn't being shared with my remote, but I'm totally confused as to why this particular repository didn't install like all the other ones. As far as I know I did nothing different with Composer or the Git push/pull I always do.

Thoughts?

Was it helpful?

Solution

I'm not sure what's wrong in your case, but for what it's worth the Composer documentation recommends committing the composer.json and composer.lock files and excluding the vendor/ directory from version control.

Then, on other machines where you need to have dependencies (e.g. other development machines, staging and production servers, etc.) you can use composer install or composer update and let the system keep all of your dependencies synchronized for you.

This is one of the major benefits of using a dependency manager: You can define your project's dependencies in a data file, and everybody can use that data file to get the exact same versions of everything installed automatically, without including external libraries in your repository.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top