Why is PHP Composer so slow?

前端 未结 13 2016
攒了一身酷
攒了一身酷 2021-01-29 19:03

Why is PHP Composer so slow when all I do is init a project with zero dependencies? Here are the commands I run:

composer init

13条回答
  •  太阳男子
    2021-01-29 19:34

    1. Make sure you have the latest version of Composer.
    2. Install in verbose mode by adding -vvv, for example composer global require "squizlabs/php_codesniffer=*" -vvv
    3. If you are able to find out where Composer is facing slowness, for example mine was getting stuck for 5 minutes when downloading packages. It took >5 minutes to download a 20 kB file on a 50 Mbit/s connection. This was because it was downloading the packages from packagist using HTTP and not HTTPS. Making these changes to the configuration has resolved my issue: composer config --global repo.packagist composer https://packagist.org

提交回复
热议问题