我为一个新项目创建了一个全新的Lumen安装,我正在尝试将Redis设置为Cache/Session驱动程序.通过作曲家,我能够安装Predis
没有问题,然后在尝试运行时:
composer require illuminate/redis
我收到这个错误,这告诉我Composer因为不同的库要求不同的版本而感到困惑illuminate/support
,正如我从这个问题中所理解的那样:
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" } }
我的问题是,我做错了什么?,上面链接的问题建议手动更改来解决这个问题.但我相信设置是如此基本,我应该在这里做错事.
我不得不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" } }