composer.json 的一点疑惑

2015-11-29 12:07:04 +08:00
 whatisnew

composer.json 中的 require-dev 的是开发环境中需要的依赖,但是我怎么告诉 composer 当前的开发环境是生产还是开发呢?

然后:

"minimum-stability": "stable",
"require-dev": {
    "phpunit/phpunit": "~4.6",
},

包的版本号可不可以不写呢?
如何才能始终 composer 最新的 stable 版?

2283 次点击
所在节点    PHP
6 条回复
yangqi
2015-11-29 12:30:49 +08:00
composer install --dev / --no-dev
jsthon
2015-11-29 12:35:16 +08:00
我给版本号直接写的是 "*" ,似乎没有什么问题
whatisnew
2015-11-29 12:41:02 +08:00
@yangqi 。。。这个不能在生产机上才 `install` 吧
Pastsong
2015-11-29 13:24:59 +08:00
@whatisnew 就是这么用的啊,不然要它干嘛
https://getcomposer.org/doc/03-cli.md#install
whatisnew
2015-11-29 13:55:55 +08:00
@Pastsong 考虑过负载均衡的感受吗
yangqi
2015-11-29 22:28:20 +08:00
@whatisnew 生产机上才要 install, 不要 update ,不然有可能会和开发机上装得版本不一样。 install 装的是 composer.lock 里面的版本

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/239768

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX