hoaproject / Console

The Hoa\Console library.
https://hoa-project.net/
366 stars 32 forks source link

Not installable with composer #9

Closed Aust1994 closed 10 years ago

Aust1994 commented 10 years ago
$ composer require hoa/websocket:dev-master
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for hoa/websocket dev-master -> satisfiable by hoa/websocket[dev-master].
    - hoa/websocket dev-master requires hoa/core dev-master -> no matching package found.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Installation failed, reverting ./composer.json to its original content.
thehawk970 commented 10 years ago

Hey have you the "minimum-stability" : "dev" on your composer.json ? http://hoa-project.net/En/Literature/Learn/Install.html#Depuis_Composer_et_Packagist

Hywan commented 10 years ago

Better link: http://hoa-project.net/Source.html#Dependency_manager_%28Composer%29

jubianchi commented 10 years ago

Unless you are only requiring Hoa packages, setting min-stab to dev is wrong. Let me explain : when you set this flag with the dev value, composer will allow itself to download unstable version for each packages listed in your composer.json. You will likely don't want to get unstable version for all your dependencies.

A better way of doing this is to require every dependency of the package your are requesting and marking them as dev:

{
    "require": {
        "hoa/console": "*@dev",
        "hoa/core": "*@dev",
        "hoa/string": "*@dev",
        "hoa/stream": "*@dev"
    }
}

Here, the package i rally require is hoa/consolebut to allow composer to download unstable dependencies of hoa/console I have to also require them here. This is because of how composer works : the root package (your project) is the only one allowed to loosen the minimum-stability.

I agree that this can be boring, repeating packages dependencies in your composer.json could be a pain because you have to stick with the package (here it is hoa/console) dependecies : if they change, you also have to change your composer.json to update your deps. But, it's the most secure way of doing things if Hoa's packages are not the only ones your require. Say you also require Symfony components, you will not want to get unstable version of those too.

Composer does not handle rolling-release and this is a pity as Hoa, but not only (we also have problems with @atoum), works with rolling-release principles.

Hope this helps ;)

Hywan commented 10 years ago

@jubianchi: :+1:.

Hywan commented 10 years ago

Can we close this issue?

stephpy commented 10 years ago

@jubianchi :+1:

jubianchi commented 10 years ago

A tiny update for those getting here. I never loosen min-stab flag in my composer.json files, I always use the tips I gave in my previous comment.

It turns out that sometimes, requires are messy so I now use a tiny convention to make things clear. Let me show you:

{
    "require": {
        "hoa/console": "*@dev",
            "hoa/core": "*@dev",
            "hoa/string": "*@dev",
            "hoa/stream": "*@dev"
    }
}

I use indentation to make things clear: here, hoa/console requires some dev deps. so I indent them under hoa/console. I find this more clean. Also, with this, we don't have to question ourselves on "Why this deps is here?! I never use it in my code!"

@Hywan I think we can close this issue.

Hywan commented 10 years ago

Thanks!