Running composer require/update Sometimes Very Slow and Takes Very Long Time



I live in a lovely developing country, Indonesia. Internet is still an expensive thing and bandwidth is not so high among other nearby countries. You can find the comparison below.

Asia internet speed

Being web developer, especially PHP, having always available internet connection is an important thing. Push the code to repository, upload the files to web server, bower install <somejavascript>, composer require <somephpscript>, etc. Sometimes, the connection is slow when accessing some area, like Europe or US East Coast. This could make my life hard, especially when I'm on tight deadline and the application needs many dependencies.


When above issue happens, I will lose many times just to wait for composer require/update process finished. Time is very precious thing we don't want to waste, right?

Investigation and Solution

First, I try to examine what really happens under the hood when I run composer require command. I run:

composer --prefer-dist --verbose -vvv require guzzlehttp/guzzle

After quick check, I figured out that is hosted in France. I also noticed the issue sometimes happens and sometimes not. When it happens I still have a good connectivity with gmail and VPS (my VPS is in US). My conclusion is it seems that my internet doesn't have a good connectivity to France.

I thought of creating a mirror, but it seems there were no public mirror available. Thankfully, I found this article

The solution is to use a CDN based packagist URL:, which can be done using this command:

composer config --global repositories.packagist composer

1 comment

  1. Really seems to do the trick!

    Working here in South East Asia region, and composer was way too slow, this speeds it up a lot.

Leave a reply

Your email address will not be published. Required fields are marked *