1

For example, here is a portion of my composer.json

"repositories": [
    {
        "type": "git",
        "url":  "ssh://git@gitlab.domain.com/project/package.git"
    }
],

Now I'm working on the project locally, so I already have package in another folder.

Do I really need to push the changes for package to the remote repo, then pull it in my project repo? Or is there a way to tell composer that this repo is also available locally?

EDIT: Basically, how do I say "use this local repo if it exists, otherwise use this remote repo"?

Sarke
  • 2,805
  • 2
  • 18
  • 28

1 Answers1

1

I don't know if you have solved this problem but I had the same and searching/googling I found a smart solution in Composer and multiple branches.

In a nutshell you can use the COMPOSER environment variable to set the composer.json filename so you can get a composer.json for development (composer.dev.json for example) and another for production (composer.pro.json). Then you can use it as follows:

COMPOSER=composer.dev.json php composer.phar install
Javier Gálvez
  • 166
  • 1
  • 11
  • How do you deal with the composer.lock file being different? – Sarke Mar 13 '18 at 23:29
  • When you specify the composer file to use it will generate you a composer.lock with the same name. For example, if you use composer.dev.json it will generate composer.dev.lock – Javier Gálvez Mar 15 '18 at 06:50