V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
whatisnew
V2EX  ›  PHP

composer.json 的一点疑惑

  •  
  •   whatisnew · Nov 29, 2015 · 2662 views
    This topic created in 3802 days ago, the information mentioned may be changed or developed.

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

    然后:

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

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

    6 replies    2015-11-29 22:28:20 +08:00
    yangqi
        1
    yangqi  
       Nov 29, 2015
    composer install --dev / --no-dev
    jsthon
        2
    jsthon  
       Nov 29, 2015
    我给版本号直接写的是 "*" ,似乎没有什么问题
    whatisnew
        3
    whatisnew  
    OP
       Nov 29, 2015
    @yangqi 。。。这个不能在生产机上才 `install` 吧
    Pastsong
        4
    Pastsong  
       Nov 29, 2015
    @whatisnew 就是这么用的啊,不然要它干嘛
    https://getcomposer.org/doc/03-cli.md#install
    whatisnew
        5
    whatisnew  
    OP
       Nov 29, 2015
    @Pastsong 考虑过负载均衡的感受吗
    yangqi
        6
    yangqi  
       Nov 29, 2015
    @whatisnew 生产机上才要 install, 不要 update ,不然有可能会和开发机上装得版本不一样。 install 装的是 composer.lock 里面的版本
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1210 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 17:59 · PVG 01:59 · LAX 10:59 · JFK 13:59
    ♥ Do have faith in what you're doing.