Question

My project automated deployment relies on Composer to install all dependencies.
Every time I deploy, deployment scripts asks for a fresh install, but the composer.lock is always the same, no dependency changes between deploys.

Librairies referenced with a version number ("twig/twig": "1.12.*") loads from cache. But thoses with a branch/commit reference ("dompdf/dompdf" : "dev-master#424c235") always triggers a git clone to GitHub.

As for the others libraries, theses versions didn't changed, but aren't loaded from cache.

Loading composer repositories with package information
Installing dependencies from lock file

- Installing phenx/php-font-lib (0.2.1)
Loading from cache

- Installing dompdf/dompdf (dev-master 424c235)
Cloning 424c235

- Installing endroid/qrcode (dev-master 4eb83c9)
Cloning 4eb83c9

- Installing j4mie/idiorm (v1.3.0)
Loading from cache

- Installing j4mie/paris (v1.3.0)
Loading from cache

- Installing jamesiarmes/php-ews (master edbcb65)
Cloning edbcb65

- Installing symfony/process (v2.3.1)
Loading from cache

- Installing kriswallsmith/assetic (dev-master 0a55a9b)
Cloning 0a55a9b

- Installing kriswallsmith/buzz (v0.10)
Loading from cache

- Installing psr/log (1.0.0)
Loading from cache

- Installing monolog/monolog (1.5.0)
Loading from cache

- Installing mtdowling/cron-expression (v1.0.1)
Loading from cache

- Installing respect/validation (0.4.4)
Loading from cache

- Installing ruudk/twitter-oauth (dev-master a4c0094)
Cloning a4c0094

- Installing slim/slim (2.2.0)
Loading from cache

- Installing slim/extras (2.0.1)
Loading from cache

- Installing symfony/console (v2.2.2)
Loading from cache

- Installing tedivm/jshrink (v0.5.1)
Loading from cache

- Installing twig/twig (v1.12.3)
Loading from cache

- Installing zendframework/zend-stdlib (2.1.5)
Loading from cache

- Installing zendframework/zend-authentication (2.1.5)
Loading from cache

- Installing zendframework/zend-permissions-acl (2.1.5)
Loading from cache

- Installing zendframework/zend-session (2.1.5)
Loading from cache

TL; DR;

How to make Composer fetch from the local cache the dependencies referenced by a commit ?

Was it helpful?

Solution

Don't clone from Github, download ZIPs instead. The flag --prefer-dist will trigger this when you update. Without this, there is no cache entry for that package, there is only the cloned repo in the vendor folder which pulls in any changes and then checks out the required commit id.

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