dbrumann
dbrumann

Reputation: 17166

Composer does not fetch dependencies from local repository

I am trying to add a local project A as dependency to project B. Using git daemon I am able to fetch project A as dependency, but the dependencies defined with require in the composer.json in project A are not recognized. What am I missing?

project A:

{
    "name": "project/a",
    "require": {
        "monolog/monolog": "dev-master"
    }
}

project B:

"repositories": [
    {
        "type": "vcs",
        "url": "git://localhost/home/user/project-a"
    }
],
"require": {
    "project/a": "dev-master"
}

result (in project B):

vendor/
  project/a

expected:

vendor/
  project/a
  monolog/monolog

Upvotes: 6

Views: 2912

Answers (2)

Crisu83
Crisu83

Reputation: 93

I encountered a similar issue and my issue was that I was running composer update instead of composer install and one of the libraries that I required defined some of its dependencies as zipballs from GitHub.

Upvotes: 0

Seldaek
Seldaek

Reputation: 42076

The most likely explanation is that you forgot to commit the changes to your composer.json in /home/user/project-a.

To debug this you can use composer show project-a dev-master -v. The -v will output more verbose info while it loads the repository, and then you will see details about the version you are installing, if it does not contain the monolog require, then I would say my guess above was correct. If it does contain it, we got a serious bug in composer and you should report it on github.

Upvotes: 9

Related Questions