A
A
Anton Medvedev2012-08-08 21:58:20
PHP
Anton Medvedev, 2012-08-08 21:58:20

Managing nested dependencies with Composer?

I can't understand why composer doesn't want to work: I have two repositories: Main and Second.
Main composer.json:

{
    "name":"Elfet/Main",
    "type":"library",
    "require":{
        "php":">=5.3.0"
    }
}

Second depends on Main:
{
    "name":"Elfet/Second",
    "type":"library",
    "require":{
        "php":">=5.3.0",
        "Elfet/Main":"dev-master"
    },
    "repositories":[
        {
            "type":"git",
            "url":"http://github.com/Elfet/Main"
        }
    ]
}

If I do in Second: composer install - everything is installed well.
However, if I do another project (depends on Second):
{
    "require":{
        "php":">=5.3.0",
        "Elfet/Second":"dev-master"
    },
    "repositories":[
        {
            "type":"git",
            "url":"http://github.com/Elfet/Second"
        }
    ]
}

Then composer does not want to work and gives the following:
Installing dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for elfet/second dev-master -> satisfiable by Elfet/Second dev-master.
- Elfet/Second dev-master requires elfet/main dev-master -> no matching package found.


What is the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Davert, 2012-08-08
@Elfet

Not sure if this is it, but most likely...
You may run into problems when using custom repositories because Composer does not load the repositories of your requirements, so you have to redefine those repositories in all your composer.json files.
getcomposer.org/doc/faqs/why-can't-composer-load-repositories-recursively.md _

V
Vyacheslav Slinko, 2012-08-09
@KeepYourMind

1. Did you publish elfet/second on packagist?
2. Try to add in the third composer.json"minimum-stability": "dev"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question