V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
whatisnew
V2EX  ›  PHP

composer.json 的一点疑惑

  •  
  •   whatisnew · 2015-11-29 12:07:04 +08:00 · 2274 次点击
    这是一个创建于 3082 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    然后:

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

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

    6 条回复    2015-11-29 22:28:20 +08:00
    yangqi
        1
    yangqi  
       2015-11-29 12:30:49 +08:00
    composer install --dev / --no-dev
    jsthon
        2
    jsthon  
       2015-11-29 12:35:16 +08:00
    我给版本号直接写的是 "*" ,似乎没有什么问题
    whatisnew
        3
    whatisnew  
    OP
       2015-11-29 12:41:02 +08:00
    @yangqi 。。。这个不能在生产机上才 `install` 吧
    Pastsong
        4
    Pastsong  
       2015-11-29 13:24:59 +08:00
    @whatisnew 就是这么用的啊,不然要它干嘛
    https://getcomposer.org/doc/03-cli.md#install
    whatisnew
        5
    whatisnew  
    OP
       2015-11-29 13:55:55 +08:00
    @Pastsong 考虑过负载均衡的感受吗
    yangqi
        6
    yangqi  
       2015-11-29 22:28:20 +08:00
    @whatisnew 生产机上才要 install, 不要 update ,不然有可能会和开发机上装得版本不一样。 install 装的是 composer.lock 里面的版本
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1006 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 20:38 · PVG 04:38 · LAX 13:38 · JFK 16:38
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.