Speed up composer!

Are you experiencing slow composer update? Well there is a solution!

After some google research I have found to Fixes!

Let’s start with some benchmarks

Benchmarks – Small Json

Before every test I have executed composer cache:clear so the results don’t cheat by using the cache!

I have just this Test composer

before no cache:

after no cache and fix 1:

after no cache and fix 1 + 2:

Benchmarks – Magento Create Project

Yeah this is an interesting part!

before no cache:

after no cache and fix 1 + 2:

That’s a big difference!!!!

Fix 1

Yeah this is the part were you all have been waiting for!

Change the IP which you use for packagist.org I use this one now and it is very fast!

Just add the following line to your /etc/hosts (when you have MacOS) packagist.org

More information about this you can find in this old article in which the IPs are no longer the same
source: https://medium.com/@matriphe/how-to-speed-up-php-composer-629bed0d9b15

Fix 2

Start using prestissimo a composer plugin. This is a composer plugin that downloads packages in parallel to speed up the installation process.

Easy to install by running composer global require hirak/prestissimo
source: https://github.com/hirak/prestissimo

And now you are all set!