php - 尽管 --prefer-dist 标志, Composer 依赖项的更新缓慢

标签 php symfony composer-php

为什么我的 Composer 依赖项最多需要两分钟才能更新,即使没有任何更改?

一个 popular suggestion是附加 --prefer-dist 标志:

php composer.phar update --prefer-dist

但这对我的情况没有影响。下面是我的 composer.json 文件——我是否遗漏了一些明显的东西?

{
    "name": "my-namespace/symfony",
    "type": "project",
    "description": "",
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.3.*",
        "doctrine/orm": ">=2.2.3,<2.4-dev",
        "doctrine/doctrine-bundle": "1.2.*",
        "twig/extensions": "1.0.*",
        "symfony/assetic-bundle": "2.3.*",
        "symfony/monolog-bundle": "2.3.*",
        "sensio/framework-extra-bundle": "2.3.*",
        "sensio/generator-bundle": "2.3.*",
        "sensio/distribution-bundle": "2.2.*",
        "my-namespace/my-bundle": "1.0.*"
    },
   "repositories": [
        {
            "type": "vcs",
            "url": "http://username:password@git.com/my-bundle.git"
        }
    ],    
    "scripts": {
        "post-install-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ],
        "post-update-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "minimum-stability": "dev",
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "branch-alias": {
            "dev-master": "2.3-dev"
        }
    }
}

最佳答案

此问题通常与在 CLI 环境中加载 xdebug 有关。 (是否启用 xdebug 无关紧要。)

您可以使用以下命令之一检查是否启用了 xdebug。

// Unix
php -m | grep xdebug
// Windows
php -m | findstr xdebug

通过启用最大详细程度和分析信息,可以获得有关哪些操作需要这么长时间的更多信息。 (如果要更新软件包,请将 install 替换为 update。)

composer install --prefer-dist -vvv --profile

关于php - 尽管 --prefer-dist 标志, Composer 依赖项的更新缓慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19316650/

相关文章:

php - WAMP 和 pcntl_fork

Symfony 2.6 默认选中复选框

php - 是否可以在没有 PEAR 或 Composer 的情况下安装 Doctrine?如果是这样,如何?

php - PHP:-在多维数组中

PHP simplexml_load_file - 错误处理

PHP 中的 C# NetworkCredential

bash - symfony 服务器 :start command throwing an error

php - FOSRestBundle + Symfony 3.4 : rest type not reconized

php - 在 bluehost 上为 laravel 应用程序设置服务器并遇到 php -v 问题

php - Composer - 自动加载和 PSR-0 与 PSR-4