Search code examples
phprediscomposer-phplumenpredis

Composer - illuminate/redis installation fails because of different versions of illuminate/support


I created a fresh installation of Lumen for a new project, and I am trying to setup Redis as the Cache/Session driver. Through composer I was able to install Predis with no issues, and then when trying to run:

composer require illuminate/redis

I am getting this error, which is telling me that Composer is being confused since different libraries are asking for different version of illuminate/support, as I understood from this question:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Can only install one of: illuminate/support[v5.2.0, v5.1.25].
    - Can only install one of: illuminate/support[v5.2.0, v5.1.25].
    - Can only install one of: illuminate/support[v5.2.0, v5.1.25].
    - illuminate/redis v5.2.0 requires illuminate/support 5.2.* -> satisfiable by illuminate/support[v5.2.0].
    - Installation request for illuminate/redis ^5.2 -> satisfiable by illuminate/redis[v5.2.0].
    - Installation request for illuminate/support == 5.1.25.0 -> satisfiable by illuminate/support[v5.1.25].


Installation failed, reverting ./composer.json to its original content.

Below is my composer.json, which is pretty basic:

{
    "name": "laravel/lumen",
    "description": "The Laravel Lumen Framework.",
    "keywords": ["framework", "laravel", "lumen"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.5.9",
        "laravel/lumen-framework": "5.1.*",
        "vlucas/phpdotenv": "~1.0",
        "predis/predis": "^1.0"
    },
    "require-dev": {
        "phpunit/phpunit": "~4.0",
        "fzaninotto/faker": "~1.0"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/"
        },
        "classmap": [
            "database/"
        ]
    },
    "autoload-dev": {
        "classmap": [
            "tests/"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}

My question is, what am I doing wrong ? , the question linked above suggests manual changes to solve this. but I believe the setup is so basic, I should be doing something wrong here.


Solution

  • I had to edit the composer.json file with the needed version of illuminate/redis; forcing it to use the same version, as follows:

    {
        "name": "laravel/lumen",
        "description": "The Laravel Lumen Framework.",
        "keywords": ["framework", "laravel", "lumen"],
        "license": "MIT",
        "type": "project",
        "require": {
            "php": ">=5.5.9",
            "laravel/lumen-framework": "5.1.*",
            "vlucas/phpdotenv": "~1.0",
            "predis/predis": "^1.0",
            "illuminate/redis" : "5.1.*"
        },
        "require-dev": {
            "phpunit/phpunit": "~4.0",
            "fzaninotto/faker": "~1.0"
        },
        "autoload": {
            "psr-4": {
                "App\\": "app/"
            },
            "classmap": [
                "database/"
            ]
        },
        "autoload-dev": {
            "classmap": [
                "tests/"
            ]
        },
        "config": {
            "preferred-install": "dist"
        }
    }