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 编写vba代码实现数据录入工作
  • ¥15 做过TCL海信电视小米电视相关影视会员软件私我
  • ¥15 Mapreduce是正常的,在运行其他jar包时并没有任何问题,只是在做LogCount.jar 时出的问题。如图所示
  • ¥15 ImportError: DLL load failed while importing _iterative: 找不到指定的模块。
  • ¥15 如何通过交互分析得出某高危患者对放疗获益更多
  • ¥15 相关性分析中,p<0.05, r=0.29,怎么评价相关性呢
  • ¥15 docker部署Mongodb后输入命令报错?
  • ¥15 将下列流程图转变成python程序代码
  • ¥15 我需要全国每个城市的最新小区名字等数据。
  • ¥15 开发一个小区生态的小程序