在composer中指定项目根目录之外的依赖项

I have a directory of projects. Each of these is from a git repo.

Some of these projects are REST APIs, and I want everything specified as a project dependency, like this:

htdocs
|- restApi1
|- restApi2
    |- Vendor
        |-Guzzle
|- restApi3

So project 2 has a dependency on restApi1 and restApi3. What I want to do is 'git checkout' if restApi1 or restApi3 is missing when I install restApi2 and build. If it is already checked out, upon composer install or update, I want it to git pull and rebuild to a custom command, that's it. Since I have these setup as projects and I might be working on a change across two projects, if I pull as a dependency in like this:

htdocs
|- restApi1
|- restApi2
    |- Vendor
        |- Guzzle
        |- restApi1
        |- restApi3
|- restApi3

I have to do work to pull my changes into their repo, work to new URLs and it disrupts my workflow. Since I hit the projects through http on localhost, I can check out whatever version from wherever and treat everything as if it were one big project of sorts, where all my codebases appear once.

Im wondering if there is a way to do this in composer, or if this is the wrong way to go about it. Im also willing to switch my flow if theres a better way that conflicts the above. Ive considered writing a script to run on htdocs that rifles through and pulls everything, but I think specifying other projects as a dependency in the composer file reveals more info about how our internal prohjects use each other.

查看全部
douhao5280
douhao5280
2017/03/14 09:12
  • git
  • build
  • php
  • dependencies
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复