PHP Composer:无开发模式

问题描述:

当您使用作曲家安装更新一个项目时,您可以告诉它跳过与开发相关的依赖项(测试,构建工具等),并带有-no-dev 标志

When you install or update a project with composer, you can tell it to skip the development related dependencies (tests, build tools, etc.) with the --no-dev flag

composer.phar update --no-dev

没有此标志,作曲家将始终下载

Without this flag, composer will always download the extra dependencies.

有没有办法(以编程方式或其他方式)告诉作曲家始终跳过开发依赖项?也就是说,是否有任何与伪代码匹配的真实代码

Is there any way (programmatically or otherwise) to tell composer to always skip the development dependencies? That is, is there anything real code that matches the pseudo code

//File: composer.json
//...
"no-dev":"true"
//...


简而言之:否-尚未。

Composer的默认安装模式是安装开发依赖项。

Composer's default installation mode is to install development dependencies.

据我所知,只有CLI选项-no-dev 和没有配置选项。

As far as i know, there is only the CLI option --no-dev and no config option.

可以在项目的composer.json中定义配置部分,请参见 https://getcomposer.org/doc/04-schema.md#config

It's possible to define a config section in the composer.json of a project, see https://getcomposer.org/doc/04-schema.md#config

但是快速浏览一下显示的源代码,没有为此的配置指令。 https://github.com/composer/composer/blob/master/src/ Composer / Config.php#L22

But a quick glance at the source code revealed, that there is no configuration directive for this. https://github.com/composer/composer/blob/master/src/Composer/Config.php#L22

{
    "config": {
        "no-dev": "true"
    }
}

+1这个想法。它可能是Config类的有用补充。

+1 for this idea. It could be a useful addition to the Config class.