Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 804
dbrumann Avatar asked Apr 08 '12 16:04

dbrumann


People also ask

Why is my composer not working?

Double-check you don't have typos in your composer. json or repository branches and tag names. Be sure to set the right minimum-stability. To get started or be sure this is no issue, set minimum-stability to "dev".

How do I update composer and all dependencies?

To update dependencies two commands can be used: composer update and composer require . The difference between these two commands is that composer update will try to update a dependency based on the current constraints in composer. json and will only update composer. lock .

Where does composer get packages from?

Composer will look in all your repositories to find the packages your project requires. By default, only the Packagist.org repository is registered in Composer. You can add more repositories to your project by declaring them in composer. json .


1 Answers

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.

like image 130
Seldaek Avatar answered Sep 24 '22 05:09

Seldaek