PHP Composer 未安装 - 您的要求无法解析为一组可安装的软件包

PHP Composer not installing - Your requirements could not be resolved to an installable set of packages

我刚刚设置 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",在 运行 composer require slim/views 之前的 name 标记之后,composer require运行良好,软件包已安装。不确定发生了什么;有人可以帮我解决这个问题吗?

谢谢!

正如 ChrisForrence 所暗示的,您的包名称 slim/slim 与同名库冲突。 将您的软件包名称更改为其他名称,slim 将按预期安装。

"name": "sasanka/my-app"