为什么 PHP Composer 这么慢?

2022-01-21 00:00:00 php composer-php

为什么 PHP Composer 这么慢,而我所做的只是用零依赖?以下是我运行的命令:

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

<一步一步创建composer.json,定义0个零依赖>

<step through composer.json creation, define 0 zero dependencies>

composer install

等待 3 分钟(并不夸张).

Wait 3 minutes (not an exaggeration).

所有 composer 所要做的就是拉入一个自动加载器并创建 /vendor,那么为什么需要这么长时间呢?就此而言,为什么 composer init 上没有发生该步骤?

All composer has to do is pull in an autoloader and create /vendor, so why does it take so long? For that matter, why doesn't that step happen on composer init?

是否有一个配置选项可用于在 init 时拉入缓存的自动加载器和供应商?

Is there a configuration option I can use to pull in a cached autloader and vendor upon init?

推荐答案

另外,禁用 Xdebug.即使运行像 composer --version 这样简单的命令,Xdebug 也会导致 Composer 花费几分钟.

Also, disable Xdebug. Xdebug can cause Composer to take minutes even when running a command as simple as composer --version.

相关文章