Caching composer dependencies

TL;DR Add this to your circle.yml:

dependencies:
  cache_directories:
    - ~/.composer/cache

A naive way to cache composer dependencies would be to add the install directory to the cache_directories section of your circle.yml. Unfortunately, composer doesn’t seem to care that you have cached dependencies and will install them all over again. You can fix this by adding composer’s cache to your cache_directories. This way, composer does not need to download your dependencies on every build.

6 Likes

This was super helpful, thanks. But incomplete.

To really speed up Composer you also need to cache the vendor directory. And it only took me a few extra hours to finally figure that out… :frowning:

Hi. do I need to use restore_cache and save_cache on top of cache_directories??

@liaogz82: what are you trying to do? I am not sure if your question is answerable without a lot more context.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.