Baba Tech Blog

TR EN

Solution to Composer Slow Download Problem

This article is older than 2 years. Some information might be outdated.

Composer Slow Download Issues and Solutions ⚡#

Have you noticed packages downloading slowly when using Composer? Don't worry! You can increase your speed using the methods below. 💨

composer diagnose
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: 1 OK
Checking disk free space: OK
Checking pubkeys: FAIL Missing pubkey for tags verification
Missing pubkey for dev verification
Run composer self-update --update-keys to set them up Checking composer version: OK
Composer version: 1.9.1 PHP version: 7.4.0 PHP binary path: /usr/bin/php

1️⃣ Diagnosing the Issue: composer diagnose#

First, run the following command to detect current issues:

composer diagnose

If you get an error message like below, Composer might need updated public keys:

Checking pubkeys: FAIL Missing pubkey for tags verification
Missing pubkey for dev verification
Run composer self-update --update-keys to set them up

To solve this issue:

composer self-update --update-keys

Alternatively, go to the ~/.config/composer/ directory and create the following two files, then add the updated keys from the Composer Public Key page:

  • keys.dev.pub
  • keys.tags.pub

Then close and reopen your terminal and run the composer diagnose command again. ✅

2️⃣ IPv6 Issue and Solution 🌍#

In some networks, IPv6 connections may cause timeouts. If your Composer operations take longer than expected, try disabling IPv6:

sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"

After performing this operation, test Composer again. 🚀

3️⃣ Updating Composer Package Source 🔄#

By default, Composer works through packagist.org. If your connection is slow, you can update the packagist address with the following command:

composer config --global repo.packagist composer https://packagist.org

This operation can enable packages to load faster. 🔥

4️⃣ Using Parallel Download ⏩#

To speed up Composer operations, you can install the prestissimo plugin. This plugin enables packages to be downloaded simultaneously:

composer global require hirak/prestissimo

However, remember that prestissimo has become unnecessary in Composer 2.0 and later versions. If you are using Composer 1.x, you can try this method. 😉

5️⃣ In-depth Debugging 🕵️‍♂️#

To see what Composer is doing in detail, you can use the following commands:

composer -vvv require phpunit/phpunit

This command will show downloaded files and network connections in detail. If you notice any problems, you can apply the above solutions according to the error messages. 🛠️

Conclusion 🎯#

Slow download issues with Composer can be frustrating, but you can gain significant speed by applying the methods above. In summary:

✅ Check errors with composer diagnose ✅ Turn off IPv6 connection ✅ Update Packagist address ✅ Use parallel download plugin ✅ Perform detailed debugging

I hope this guide makes your Composer usage more enjoyable! 🎉 Don't forget to leave a comment if you encounter any errors! 👇 Composer Speed Optimization

Webmentions

Likes

  • Loading likes...

Comments & Replies

  • Loading comments...

Comments
Reply via Bluesky

With an account on the Fediverse or Mastodon, you can respond to this post.

Copy and paste this URL into the search field of your favourite Fediverse app or the web interface of your Mastodon server.

Loading comments...