Caching PECL packages

We’re working with PHP (with the Laravel framework) and we use pecl packages like php-mongo.

When using composer we can easily cache the packages by setting the vendor directory to be saved and it’ll only get updated if there’s something updated. Also we already cache for example the mongo upgrade directory.

The problem is that PECL installs make more than half of the time of our testing process on CircleCI and we push a lot. Real lot.

So the question is, what solution would you recommend to cache pecl packages nicely?

Thanks,
Bálint

Sorry for the delay here @balintant.

Does PECL install the dependencies into a known directory? For example, it would be node_modules for npm and vendor/bundle for bundler.

If there is a known directory where all packages get downloaded to, it should be easy to cache it with the cache_directories statement in your circle.yml:

dependencies:
  cache_directories:
    - <path-to-pecl-install-dir>

Please mind that the cache is collected right after the dependencies step, so to make sure the packages are cached, they have to be present in the directory at the end of the dependencies step or earlier.

1 Like

Hey,
I think it is outside of the home directory, so we cannot just add to the cache list. (May be with a symbolic link?) :frowning: