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条)

报告相同问题?

悬赏问题

  • ¥30 Windows Server 2016利用兩張網卡處理兩個不同網絡
  • ¥15 Python中knn问题
  • ¥15 使用C#,asp.net读取Excel文件并保存到Oracle数据库
  • ¥15 C# datagridview 单元格显示进度及值
  • ¥15 thinkphp6配合social login单点登录问题
  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源