如何通过composer安装联盟/ OAuth2客户端

时间:2015-07-04 07:26:11

标签: oauth-2.0 composer-php

我试图通过ubuntu上的作曲家安装联盟/ oauth2-client时遇到错误,最新的curl和openssl库结合了最新的php版本:

$ composer require league/oauth2-client
Using version ^0.12.1 for league/oauth2-client
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Installation request for league/oauth2-client 1.0.x-dev -> satisfiable by league/oauth2-client[1.0.x-dev].
- Can only install one of: league/oauth2-client[0.12.1, 1.0.x-dev].
- Installation request for league/oauth2-client ^0.12.1 -> satisfiable by league/oauth2-client[0.12.1].

Installation failed, reverting ./composer.json to its original content.
到目前为止,

通过搜索答案找不到任何提示。提前感谢您对此的任何帮助!

composer.json的强者

$ cat composer.json 
{
    "name": "league/oauth2-client",
    "description": "OAuth 2.0 Client Library",
    "license": "MIT",
    "require": {
        "php": ">=5.5.0",
        "ext-curl": "*",
        "ircmaxell/random-lib": "~1.1",
        "guzzlehttp/guzzle": "~6.0"
    },
    "require-dev": {
        "phpunit/phpunit": "~4.0",
        "mockery/mockery": "~0.9",
        "squizlabs/php_codesniffer": "~2.0",
        "satooshi/php-coveralls": "0.6.*",
        "jakub-onderka/php-parallel-lint": "0.8.*"
    },
    "keywords": [
        "oauth",
        "oauth2",
        "authorization",
        "authentication",
        "idp",
        "identity",
        "sso",
        "single sign on"
    ],
    "authors": [
        {
            "name": "Alex Bilbie",
            "email": "hello@alexbilbie.com",
            "homepage": "http://www.alexbilbie.com",
            "role": "Developer"
        }
    ],
    "autoload": {
        "psr-4": {
            "League\\OAuth2\\Client\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "League\\OAuth2\\Client\\Test\\": "test/src/"
        }
    },
    "extra": {
        "branch-alias": {
            "dev-master": "1.0.x-dev"
        }
    }
}

2 个答案:

答案 0 :(得分:2)

我认为你错误地使用作曲家。尝试运行composer install

来自作曲家文档:

  

require命令将新包添加到composer.json文件中   当前目录。如果不存在文件,则会在文件上创建   飞。

     

install命令从当前读取composer.json文件   目录,解析依赖项,并将它们安装到供应商。

因此,如果composer.json是联盟/ oauth2-client的那个,那么只需运行composer install

如果您希望将league / oauth2-client添加为其他包的依赖项,请运行composer require league/oauth2-client

答案 1 :(得分:0)

我先修复了这个安装knpuniversity / oauth2-client-bundle的问题。所以你需要遵循这个顺序:

composer require knpuniversity/oauth2-client-bundle
composer require league/oauth2-client
composer require league/oauth2-facebook

这是我安装后的composer.json文件:

{
"knpuniversity/oauth2-client-bundle": "^1.9",
"league/oauth2-client": "^2.2",
"league/oauth2-facebook": "^2.0"
}

希望有所帮助