沃梦达 / 编程问答 / php问题 / 正文

PHP Composer:没有固定的开发模式

PHP Composer: No Dev Mode that Sticks(PHP Composer:没有固定的开发模式)

本文介绍了PHP Composer:没有固定的开发模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您使用 composer installupdate 项目时,您可以使用 告诉它跳过与开发相关的依赖项(测试、构建工具等)>--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

没有这个标志,composer 将始终下载额外的依赖项.

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"
//...

推荐答案

简而言之:没有 - 还没有.

In short: no - not, yet.

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/作曲家/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.

这篇关于PHP Composer:没有固定的开发模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:PHP Composer:没有固定的开发模式

基础教程推荐