Composer 失败--> composer 需要 sger/laravel-paypal

Posted

技术标签:

【中文标题】Composer 失败--> composer 需要 sger/laravel-paypal【英文标题】:Composer fails--> composer require sger/laravel-paypal 【发布时间】:2017-02-14 04:22:56 【问题描述】:

我想在我的 Laravel 5.3 项目中集成 paypal。我想使用 sger/laravel-paypal 包。

当我使用 composer require sger/laravle-paypal 来安装这个包时,composer 会报告我这个错误:

Using version ^0.1.0 for sger/laravel-paypal
./composer.json has been updated
> php artisan clear-compiled
Loading composer repositories with package information
Warning: Accessing php-repo.foticos.com over http which is an insecure protocol.
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for sger/laravel-paypal ^0.1.0 -> satisfiable by sger/laravel-paypal[0.1].
    - sger/laravel-paypal 0.1 requires paypal/rest-api-sdk-php 1.7.* -> satisfiable by paypal/rest-api-sdk-php[1.7.2, 1.7.3, 1.7.4, v1.7.0, v1.7.1].
    - paypal/rest-api-sdk-php 1.7.2 requires psr/log 1.0.0 -> satisfiable by psr/log[1.0.0].
    - paypal/rest-api-sdk-php 1.7.3 requires psr/log 1.0.0 -> satisfiable by psr/log[1.0.0].
    - paypal/rest-api-sdk-php 1.7.4 requires psr/log 1.0.0 -> satisfiable by psr/log[1.0.0].
    - paypal/rest-api-sdk-php v1.7.0 requires psr/log 1.0.0 -> satisfiable by psr/log[1.0.0].
    - paypal/rest-api-sdk-php v1.7.1 requires psr/log 1.0.0 -> satisfiable by psr/log[1.0.0].
    - Conclusion: don't install psr/log 1.0.0


Installation failed, reverting ./composer.json to its original content.

这是我的 composer.json 文件:


    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "repositories": [  "type": "composer", "url": "http://php-repo.foticos.com"  ],
    "require": 
        "php": ">=5.5.9",
        "laravel/framework": "5.3.*",
        "foticos/foti_api_client": "*@dev",        
        "foticos/laravel_foti_api": "*@dev",
        "foticos/laravel_foti_webutils": "*@dev",
        "barryvdh/laravel-debugbar" : "2.*",
        "predis/predis" : "~1.1@dev",
        "stripe/stripe-php": "^3.14",
        "guzzlehttp/guzzle": "~4.0"
    ,
    "require-dev": 
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~4.0",
        "phpspec/phpspec": "~2.1",
        "symfony/dom-crawler": "~3.0",
        "symfony/css-selector": "~3.0"
    ,
    "autoload": 
        "classmap": [
            "database"
        ],
        "psr-4": 
            "App\\": "app/"
        
    ,
    "autoload-dev": 
        "classmap": [
            "tests/TestCase.php"
        ]
    ,
    "scripts": 
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "pre-update-cmd": [
            "php artisan clear-compiled"
        ],
        "post-update-cmd": [
            "php artisan optimize"
        ],
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ]
    ,
    "config": 
        "preferred-install": "dist", 
        "secure-http"      : false
    

【问题讨论】:

在此之前尝试此命令:“composer require psr/log” 【参考方案1】:

这就是我设法安装它的方式:

$ composer require psr/log 1.0.0

$ composer require paypal/rest-api-sdk-php 1.7.*

$ composer require sger/laravel-paypal 0.1.0

注意:

paypal/rest-api-sdk-php 1.7.* 需要 psr/log 1.0.0 -> 可满足 通过 psr/log[1.0.0] sger/laravel-paypal 0.1 需要 贝宝/rest-api-sdk-php 1.7.*

【讨论】:

【参考方案2】:

如错误所示,您尝试安装的软件包需要 psr/log 的 1.0.0 版本,如果您检查您的 composer.lock 文件,您已经拥有的软件包的所有其他要求都需要 ^1.0~1.0它的版本,在撰写本文时,这将解析为1.1.0。 考虑到您尝试要求的软件包恰好需要 1.0.0,现在您的整套要求规则将解析为 1.0.0 您可以先删除您的composer.lock 文件和供应商文件夹,然后将"sger/laravel-paypal": "^0.1.0", 添加到您的composer.json 文件的要求中,然后再次执行composer install。

【讨论】:

以上是关于Composer 失败--> composer 需要 sger/laravel-paypal的主要内容,如果未能解决你的问题,请参考以下文章

安装失败,将 ./composer.json 还原为其原始内容 [Composer\Repository\InvalidRepositoryException]

composer怎么安装redis

Composer 安装的 PHPUnit 二进制文件使用系统提供的 ResultPrinter 并失败

在后处理缓存清除步骤中运行“composer require ...”失败

通过 composer 创建新的 laravel 项目失败,错误类 ArrayLoader not found

安装composer