When using Composer it might be very slow. Even simple commands like

composer init

or

composer install

as well as

composer create-project

are taking up to 30 minutes to run. During this time they may seem stuck, as the default behavior of composer is to not print to the console.

1. Enable verbose command execution

You can enable verbose command execution for your current command by adding the argument

-vvv

to your command.

Now you should see all the network calls composer is doing. If you see that downloading very small files from packagist.org takes quite long (> 5 minutes for a 20kB file) proceed with step two.

2. Set the connection to packagist.org to HTTPS

In case network calls using HTTP take very long you should switch the connection settings of packagist.org to HTTPS in the configuration of composer.

Execute the following command.

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

Composer should now be way faster, you can try it by running your initial command in verbose mode again.