Composer - illuminate / redis安装失败,因为不同版本的照明/支持

时间:2015-12-23 20:49:03

标签: php redis composer-php lumen predis

我为一个新项目创建了一个全新的Lumen安装,我正在尝试将Redis设置为缓存/会话驱动程序。通过作曲家,我能够安装Predis而没有任何问题,然后在尝试运行时:

composer require illuminate/redis

我收到此错误,这告诉我Composer因为不同的库要求illuminate/support的不同版本而感到困惑,正如我从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.

下面是我的composer.json,这是非常基本的:

{
    "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"
    }
}

我的问题是,我做错了什么? ,上面链接的问题建议手动更改来解决这个问题。但我相信设置是如此基本,我应该在这里做错事。

1 个答案:

答案 0 :(得分:5)

我必须使用所需版本的composer.json编辑illuminate/redis文件;强制它使用相同的版本,如下所示:

{
    "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"
    }
}