Clear Composer Cache

Posted by Darwin Biler on August 30, 2014

Whatever your intention of looking for it, you can find it by running

composer config cache-dir

Usually, in Windows it's on %LOCALAPPDATA%\Composer\
While in *nix, its usually on ~/.composer/cache

You can always force empty it by deleting those manually. At the time of writing, there is no available command "yet" to clear that. So removing the folder is your best chance on clearing things up.

Why would anyone clear the composer cache anyway?

Quick answer to that is you want to make sure your copy is always fresh. Some reasons is, when you published something in packagist, it takes time for the new release to take "effect", maybe because packagist.org is getting overloaded for some reasons.

They had added the cache stuffs in composer maybe for optimizing the resource usage of the tool, and of course to lessen the load in packagist.
If you really don't want to use the caching process altogether, you can specify this option in the composer.json file

{
  "config":{
      "cache-files-ttl":0
  }
}

If you set the cach-files-ttl to zero, composer won't cache the packages at all.

But guess what, I have a mirror repository that you can use if you think packagist.org is so slow. Please check this article about it.

Hope I helped you in some way in this article. Good Day!


Did you find this useful?

I'm always happy to help! You can show your support and appreciation by Buying me a coffee (I love coffee!).