curl error 28 while downloading https://repo.packagist.org/packages.json: Connection timeout after 10004 ms

Stefan Izdrail

Founder & Senior Architect · 2026-06-29

Laravel Company
Title: Understanding and Resolving curl error 28 while Downloading from repo.packagist.org using Composer Body:

One common issue that developers encounter when working with Composer is the infamous curl error 28. This particular error arises during the downloading of a file like https://repo.packagist.org/packages.json, which is necessary for creating a new Laravel project. Here, we will explore the reasons behind this error, discuss ways to resolve it, and offer tips to prevent future occurrences.

Understanding curl Error 28

Curl error 28 is specifically related to connection timeout. In other words, Composer tries to establish a connection with the specified URL but fails to do so within an allotted timeframe. This may result in issues while downloading files like packages.json from repo.packagist.org.

Possible Reasons Behind curl Error 28

There could be a few reasons why this error occurs:

  • Network congestion or poor internet connection: Constraints on the network can cause packet loss, reducing the speed and reliability of connections.
  • Firewall or network restrictions: Firewalls and routers might block some packets, leading to disrupted communication with the remote server.
  • DNS issues: Incorrect DNS settings or misconfiguration could cause trouble when trying to resolve domain names into IP addresses.

Resolving curl Error 28 While Downloading from repo.packagist.org

There are several ways to overcome this error, depending on the root cause:

  1. Check your network connection: Ensure that you have a stable internet connection and are not experiencing any issues with packet loss or congestion. Try using another device or a different network to confirm if the problem lies within your infrastructure.
  2. Review firewall and router settings: Configure your firewall and router to ensure that all necessary ports are open, allowing smooth communication between your computer and remote servers. Sometimes, enabling UPnP (Universal Plug and Play) or manually configuring port forwarding can help resolve this issue.
  3. Verify DNS settings: Check and correct any incorrect or misconfigured DNS settings that might be causing issues with resolving domain names. You could use the nslookup command on Windows or the dig utility on Linux to perform these checks.

Preventing curl Error 28 in the Future

Once you've resolved the underlying issue causing connection timeouts, consider taking measures to ensure that it doesn't recur:

  • Enable HTTP proxy settings: Using a reliable proxy server can help improve download speeds and provide better network stability while working on Composer.
  • Use a VPN: Establishing a virtual private network (VPN) connection may resolve some connectivity issues if they are caused by network restrictions or poor internet quality. VPNs also offer enhanced security and privacy benefits, allowing developers to work seamlessly across different networks.
  • Upgrade your hardware: Investing in a high-speed modem and router with advanced features like load balancing can help maintain stable connections and avoid disruptions due to network congestion or poor performance.

Conclusion

The curl error 28 while downloading from repo.packagist.org is a common hurdle for developers using Composer but can be addressed by understanding its causes and implementing appropriate solutions. By following the guidelines mentioned above, you can create a stable and efficient environment to work on your Laravel projects without experiencing connection issues.