Search code examples
composer-phplaravel-5illuminate-container

How to resolve composer requirements conflicts?


I'm testing Laravel Framework new 5.1 version.

And I want to install famous barryvdh/laravel-ide-helper package.

A know that the problem is: barryvdh/laravel-ide-helper require illuminate/filesystem: 5.0.x and laravel/framework require illuminate/filesystem: 5.1.x.

How can configure my composer.json file?

Note: I have "minimum-stability": "dev" and "prefer-stable": true in my composer.json file.

On installing, I get this error:

Problem 1
    - Conclusion: remove laravel/framework 5.1.x-dev
    - barryvdh/laravel-ide-helper 2.0.x-dev requires illuminate/filesystem 5.0.x -> satisfiable by illuminate/filesystem[5.0.x-dev, v5.0.0, v5.0.22, v5.0.25, v5.0.26, v5.0.28, v5.0.4].
    - barryvdh/laravel-ide-helper v2.0.0 requires illuminate/filesystem 5.0.x -> satisfiable by illuminate/filesystem[5.0.x-dev, v5.0.0, v5.0.22, v5.0.25, v5.0.26, v5.0.28, v5.0.4].
    - barryvdh/laravel-ide-helper v2.0.1 requires illuminate/filesystem 5.0.x -> satisfiable by illuminate/filesystem[5.0.x-dev, v5.0.0, v5.0.22, v5.0.25, v5.0.26, v5.0.28, v5.0.4].
    - barryvdh/laravel-ide-helper v2.0.2 requires illuminate/filesystem 5.0.x -> satisfiable by illuminate/filesystem[5.0.x-dev, v5.0.0, v5.0.22, v5.0.25, v5.0.26, v5.0.28, v5.0.4].
    - barryvdh/laravel-ide-helper v2.0.3 requires illuminate/filesystem 5.0.x -> satisfiable by illuminate/filesystem[5.0.x-dev, v5.0.0, v5.0.22, v5.0.25, v5.0.26, v5.0.28, v5.0.4].
    - don't install illuminate/filesystem 5.0.x-dev|don't install laravel/framework 5.1.x-dev
    - don't install illuminate/filesystem v5.0.0|don't install laravel/framework 5.1.x-dev
    - don't install illuminate/filesystem v5.0.22|don't install laravel/framework 5.1.x-dev
    - don't install illuminate/filesystem v5.0.25|don't install laravel/framework 5.1.x-dev
    - don't install illuminate/filesystem v5.0.26|don't install laravel/framework 5.1.x-dev
    - don't install illuminate/filesystem v5.0.28|don't install laravel/framework 5.1.x-dev
    - don't install illuminate/filesystem v5.0.4|don't install laravel/framework 5.1.x-dev
    - Installation request for laravel/framework 5.1.* -> satisfiable by laravel/framework[5.1.x-dev].
    - Installation request for barryvdh/laravel-ide-helper ^2.0@dev -> satisfiable by barryvdh/laravel-ide-helper[2.0.x-dev, v2.0.0, v2.0.1, v2.0.2, v2.0.3].

I have tried all below commands with the same results...

$ composer require barryvdh/laravel-ide-helper,
$ composer require barryvdh/laravel-ide-helper:@dev --dev
$ composer require barryvdh/laravel-ide-helper --dev --update-with-dependencies

I have tried also to create one alias on composer.json file:

"require": {
    "laravel/framework": "5.1.*",
    "illuminate/filesystem": "5.1.x-dev as 5.0.28"
},

And then have this error:

  Problem 1
    - Installation request for barryvdh/laravel-ide-helper dev-master -> satisfiable by barryvdh/laravel-ide-helper[dev-master].
    - Conclusion: remove laravel/framework 5.1.x-dev
    - Conclusion: don't install laravel/framework 5.1.x-dev
    - barryvdh/laravel-ide-helper dev-master requires illuminate/filesystem 5.0.x -> satisfiable by illuminate/filesystem[5.0.x-dev, 5.0.28].
    - don't install illuminate/filesystem 5.0.x-dev|don't install laravel/framework 5.1.x-dev
    - don't install illuminate/filesystem 5.0.28|don't install laravel/framework 5.1.x-dev
    - Installation request for laravel/framework 5.1.* -> satisfiable by laravel/framework[5.1.x-dev].

And this is my composer.json file:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "laravel/framework": "5.1.*",
        "illuminate/filesystem": "5.1.x-dev as 5.0.28"
    },
    "require-dev": {
        "phpunit/phpunit": "~4.0",
        "phpspec/phpspec": "~2.1"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "Portal\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-create-project-cmd": [
            "php -r \"copy('.env.example', '.env');\"",
            "php artisan key:generate"
        ]
    },
    "config": {
        "preferred-install": "dist"
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

Solution

  • I have solved with one alias in my composer.json file:

    "require": {
        "laravel/framework": "5.1.x-dev as 5.0.28"
    },
    

    So, laravel/framework have "illuminate/filesystem": "5.1.x-dev" and barryvdh/laravel-ide-helper thinks that have "illuminate/filesystem": "5.0.28"

    My first approach:

    "require": {
        "laravel/framework": "5.1.*",
        "illuminate/filesystem": "5.1.x-dev as 5.0.28"
    },
    

    it's not working because illuminate/filesystem it's used as subtree by laravel/framework and then i have to set the alias for laravel/framework instead of illuminate/filesystem.