Skip to content

Instantly share code, notes, and snippets.

@lsloan
Last active December 11, 2015 16:52
Show Gist options
  • Select an option

  • Save lsloan/2e3098e4d7de3640b959 to your computer and use it in GitHub Desktop.

Select an option

Save lsloan/2e3098e4d7de3640b959 to your computer and use it in GitHub Desktop.
My Composer notebook

Composer Notebook

  1. Ignoring the cache: Composer doesn't have an option to make it ignore its cache while running a command. The Composer developers do not believe this is an important feature and they refused an issue opened to request it. However, it can be helpful for debugging dependency installation. To make a single Composer command (e.g., composer update) ignore the cache, use one of the following:

    1. This version generates innocuous, ignorable errors about the cache directory:

      COMPOSER_CACHE_DIR=/dev/null composer update

      The errors are because /dev/null is not a directory. However, anything written to /dev/null disappears, leaving nothing to clean up. This shorter command line changes the value of COMPOSER_CACHE_DIR only while Composer is running. When it's finished, COMPOSER_CACHE_DIR will return to its previous value, if any.

    2. Another version that gives clean output and uses a real directory, but doesn't bother to clean it up afterwards:

      COMPOSER_CACHE_DIR=$(mktemp -d) composer update

      Be careful with this one: If many of these directories are created, it could start to use up a lot of disk space.

  2. Another note...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment