在laravel中使用composer发行Mailgun \ Bogardo软件包安装问题

时间:2019-04-25 12:00:13

标签: php laravel

我当前正在尝试使用以下命令安装Bogardo \ Mailgun作曲家软件包:

composer require bogardo/mailgun

但是,运行命令后,依赖项存在问题,我不确定如何解决此问题,因为我对Composer的经验不足。使用npm,我有npm audit fix命令,该命令可解决所有冲突,但是如何在此处解决m问题?

这是我的命令提示符显示的内容:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: don't install bogardo/mailgun v5.0.4
    - Conclusion: don't install bogardo/mailgun v5.0.3
    - Conclusion: don't install bogardo/mailgun v5.0.2
    - Conclusion: don't install bogardo/mailgun v5.0.1
    - Conclusion: remove nesbot/carbon 2.17.0
    - Installation request for bogardo/mailgun ^5.0 -> satisfiable by bogardo/mailgun[v5.0.0, v5.0.1, v5.0.2, v5.0.3, v5.0.4].
    - Conclusion: don't install nesbot/carbon 2.17.0
    - bogardo/mailgun v5.0.0 requires nesbot/carbon ^1.21 -> satisfiable by nesbot/carbon[1.21.0, 1.22.0, 1.22.1, 1.23.0, 1.24.0, 1.24.1, 1.24.2, 1.25.0, 1.26.0, 1.26.1, 1.26.2, 1.26.3, 1.26.4, 1.27.0, 1.28.0, 1.29.0, 1.29.1, 1.29.2, 1.30.0, 1.31.0, 1.31.1, 1.32.0, 1.33.0, 1.34.0, 1.34.1, 1.34.2, 1.34.3, 1.34.4, 1.35.0, 1.35.1, 1.36.0, 1.36.1, 1.36.2].
    - Can only install one of: nesbot/carbon[1.26.3, 2.17.0].
    - Can only install one of: nesbot/carbon[1.26.4, 2.17.0].
    - Can only install one of: nesbot/carbon[1.27.0, 2.17.0].
    - Can only install one of: nesbot/carbon[1.28.0, 2.17.0].
    - Can only install one of: nesbot/carbon[1.29.0, 2.17.0].
    - Can only install one of: nesbot/carbon[1.29.1, 2.17.0].
    - Can only install one of: nesbot/carbon[1.29.2, 2.17.0].
    - Can only install one of: nesbot/carbon[1.30.0, 2.17.0].
    - Can only install one of: nesbot/carbon[1.31.0, 2.17.0].
    - Can only install one of: nesbot/carbon[1.31.1, 2.17.0].
    - Can only install one of: nesbot/carbon[1.32.0, 2.17.0].
    - Can only install one of: nesbot/carbon[1.33.0, 2.17.0].
    - Can only install one of: nesbot/carbon[1.34.0, 2.17.0].
    - Can only install one of: nesbot/carbon[1.34.1, 2.17.0].
    - Can only install one of: nesbot/carbon[1.34.2, 2.17.0].
    - Can only install one of: nesbot/carbon[1.34.3, 2.17.0].
    - Can only install one of: nesbot/carbon[1.34.4, 2.17.0].
    - Can only install one of: nesbot/carbon[1.35.0, 2.17.0].
    - Can only install one of: nesbot/carbon[1.35.1, 2.17.0].
    - Can only install one of: nesbot/carbon[1.36.0, 2.17.0].
    - Can only install one of: nesbot/carbon[1.36.1, 2.17.0].
    - Can only install one of: nesbot/carbon[1.36.2, 2.17.0].
    - Can only install one of: nesbot/carbon[1.21.0, 2.17.0].
    - Can only install one of: nesbot/carbon[1.22.0, 2.17.0].
    - Can only install one of: nesbot/carbon[1.22.1, 2.17.0].
    - Can only install one of: nesbot/carbon[1.23.0, 2.17.0].
    - Can only install one of: nesbot/carbon[1.24.0, 2.17.0].
    - Can only install one of: nesbot/carbon[1.24.1, 2.17.0].
    - Can only install one of: nesbot/carbon[1.24.2, 2.17.0].
    - Can only install one of: nesbot/carbon[1.25.0, 2.17.0].
    - Can only install one of: nesbot/carbon[1.26.0, 2.17.0].
    - Can only install one of: nesbot/carbon[1.26.1, 2.17.0].
    - Can only install one of: nesbot/carbon[1.26.2, 2.17.0].
    - Installation request for nesbot/carbon (locked at 2.17.0) -> satisfiable by nesbot/carbon[2.17.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",
    "require": {
        "php": "^7.1.3",
        "fideloper/proxy": "^4.0",
        "intervention/image": "^2.4",
        "kriswallsmith/buzz": "^1.0",
        "laravel/framework": "5.8.*",
        "laravel/tinker": "^1.0",
        "mailgun/mailgun-php": "^2.8",
        "nyholm/psr7": "^1.1"
    },
    "require-dev": {
        "beyondcode/laravel-dump-server": "^1.0",
        "filp/whoops": "^2.0",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^2.0",
        "phpunit/phpunit": "^7.0",
        "stripe/stripe-php": "^6.29"
    },
    "autoload": {
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "psr-4": {
            "App\\": "app/"
        },
        "files": ["App/Helpers/Strings.php"]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "extra": {
        "laravel": {
            "dont-discover": [
            ]
        }
    },
    "scripts": {
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ],
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

1 个答案:

答案 0 :(得分:2)

由于Laravel requires Carbon 2.xyour (outdated) package requires Carbon 1.x存在冲突。最简单的解决方案是使用另一种类似于以下官方工具的mailgun软件包:https://github.com/mailgun/mailgun-php

编辑:Laravel甚至不需要其他软件包,开箱即用地支持Mailgun!

编辑2: Laravel也可以使用1.x版本,但选择不使用。老实说,我不知道如何强制Laravel使用旧版本