douzhang1299 2013-12-11 03:04
浏览 135
已采纳

如何让composer动态加载分支?

I'm using composer to organize my vendor libraries. One of these libraries is a private repository of general system classes.

The problem is that I want to have my code run out of the dev branch when it's on the dev environment, and automatically use the dev branch of my composer library. When the code is on staging, I want to use the staging branch and have composer switch to use the staging branch of the composer library. Same for production.

Is it possible for composer to pull the correct branch without having to manually switch to that branch or edit the composer.json file?

Edit: useful answer is the comments of accepted answer.

  • 写回答

2条回答 默认 最新

  • dongxia19772008 2013-12-11 22:01
    关注

    Composer is not designed to dynamically include code. In fact, it is designed to intentionally NOT change the code on it's own, but only with developer interaction (i.e. explicitly updating).

    So if you manage to require one version in your dev branch, and then merge this to staging, if you move the composer.lock unaltered, it will fetch exactly the version of your dev branch situation - now in staging. Which is actually a good thing because you do want to test the real software, and the software used to develop is the software that should go to staging and then to production - nothing else that is dynamically bound.

    I am experiencing quite the same problem with an old legacy module. It does contain configuration data, which should get rolled out differently to dev, staging and production, but I cannot use Composer for this.

    Maybe if you can describe your use case a bit more, there might be a solution for you. But I hardly believe it will contain Composer.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示