PHP Composer无法安装 - 无法将您的要求解析为可安装的软件包集

时间:2015-03-03 04:34:37

标签: php dependencies composer-php slim

我刚设置Slim Framework for PHP,我很难通过composer.json

安装slim / views库

我的composer.json看起来像这样:

{
    "name": "slim/slim",
    "type": "library",
    "description": "Slim Framework, a PHP micro framework",
    "keywords": ["microframework","rest","router"],
    "homepage": "http://github.com/codeguy/Slim",
    "license": "MIT",
    "authors": [
        {
            "name": "Josh Lockhart",
            "email": "info@joshlockhart.com",
            "homepage": "http://www.joshlockhart.com/"
        }
    ],
    "require": {
        "php": ">=5.3.0",
        "phing/phing": "2.*"
    },
    "suggest": {
        "ext-mcrypt": "Required for HTTP cookie encryption"
    },
    "autoload": {
        "psr-0": { "Slim": "." }
    }
}

当我说 composer require slim/views,我收到此错误,我不确定它在说什么:

Problem 1
    - slim/views 0.1.0 requires slim/slim >=2.0.0 -> satisfiable by slim/slim[2.0.0, 2.1.0, 2.2.0, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.5.0, 2.6.0, 2.6.1].
    - slim/views 0.1.1 requires slim/slim >=2.4.0 -> satisfiable by slim/slim[2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.5.0, 2.6.0, 2.6.1].
    - slim/views 0.1.2 requires slim/slim >=2.4.0 -> satisfiable by slim/slim[2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.5.0, 2.6.0, 2.6.1].
    - slim/views 0.1.3 requires slim/slim >=2.4.0 -> satisfiable by slim/slim[2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.5.0, 2.6.0, 2.6.1].
    - Can only install one of: slim/slim[2.0.0, 1.0.0].
    - Can only install one of: slim/slim[2.1.0, 1.0.0].
    - Can only install one of: slim/slim[2.2.0, 1.0.0].
    - Can only install one of: slim/slim[2.3.0, 1.0.0].
    - Can only install one of: slim/slim[2.3.1, 1.0.0].
    - Can only install one of: slim/slim[2.3.2, 1.0.0].
    - Can only install one of: slim/slim[2.3.3, 1.0.0].
    - Can only install one of: slim/slim[2.3.4, 1.0.0].
    - Can only install one of: slim/slim[2.3.5, 1.0.0].
    - Can only install one of: slim/slim[2.4.0, 1.0.0].
    - Can only install one of: slim/slim[2.4.1, 1.0.0].
    - Can only install one of: slim/slim[2.4.2, 1.0.0].
    - Can only install one of: slim/slim[2.4.3, 1.0.0].
    - Can only install one of: slim/slim[2.5.0, 1.0.0].
    - Can only install one of: slim/slim[2.6.0, 1.0.0].
    - Can only install one of: slim/slim[2.6.1, 1.0.0].
    - Installation request for slim/slim 1.0.0 -> satisfiable by slim/slim[1.0.0].
    - Installation request for slim/views 0.1.* -> satisfiable by slim/views[0.1.0, 0.1.1, 0.1.2, 0.1.3].

我现有的Slim Framework版本是2.6.1。我发现的一件事是,如果我在composer.json中指定"version":"2.6.1",在运行name之前composer require slim/views标记之后,composer require运行良好且包得到安装。不知道发生了什么事;有人可以帮我这个吗?

谢谢!

1 个答案:

答案 0 :(得分:3)

正如ChrisForrence所提到的,您的包名slim/slim正在与具有相同名称的库发生冲突。 将您的软件包名称更改为其他内容,slim将按预期安装。

"name": "sasanka/my-app"