Why is PHP Composer so slow?

前端 未结 13 2025
攒了一身酷
攒了一身酷 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:16

    Because Composer is implemented by file_get_contents(). That has no TCP optimizations, no Keep-Alive, no multiplexing, etc.

    I created a Composer plugin to download packages in parallel: https://packagist.org/packages/hirak/prestissimo

    $ composer global require hirak/prestissimo

    Please try it. In my environment, composer install becomes 10 times faster.

提交回复
热议问题