dongtazu3080 2014-07-30 13:40 采纳率: 100%
浏览 25
已采纳

通过composer install使用PHP构建工具会导致许多依赖项

I'm in the middle of setting up a new system for continuous integration and delivery.

As PEAR is about to EOL for most of the packages (like phpunit) i switched to composer, which seems a good idea, as i need it for the projects.

so to test my integration's server i started with a very simple composer.json:

{
    "require-dev": {
        "phpunit/phpunit": "4.1.*",
        "phpmd/phpmd" : "2.0.*",
        "pdepend/pdepend" : "2.0.0",
        "zerkalica/php-code-browser": "dev-master",
        "squizlabs/php_codesniffer": "1.*",
        "sebastian/phpcpd": "*",
        "phpdocumentor/phpdocumentor": "dev-master"
    }
}

this leads to 230MB Vendor directory.

for the full list of packages which are installed see: https://gist.github.com/rufinus/14b271f61e143364452f

Is this an expected result?

Should i switch to the PHAR files and have them stored in a bin directory inside the project?

What is the best practice? (without pear)

  • 写回答

1条回答 默认 最新

  • douhan1860 2014-07-30 19:41
    关注

    You could configure composer to download each package instead of cloning it. This should save you some space and time.

    {
        "require-dev": {
            "phpunit/phpunit": "4.1.*",
            "phpmd/phpmd" : "2.0.*",
            "pdepend/pdepend" : "2.0.0",
            "zerkalica/php-code-browser": "dev-master",
            "squizlabs/php_codesniffer": "1.*",
            "sebastian/phpcpd": "*",
            "phpdocumentor/phpdocumentor": "dev-master"
        },
        "config": {
            "preferred-install": "dist"
        }
    }
    

    To test, remove vendor, composer.lock and run composer install again. Now it should download each package, instead of cloning it.

    As a side note. Try to use a specific version instead of "*" or "dev-master". phpcpd for example I know for sure that is frequently tagged.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器