将 Yii 2.0.12 版本升级到 Yii 2.0.14 或更高版本

Upgrade version from Yii 2.0.12 to Yii 2.0.14 or higher

目前,我的项目使用的是Yii 2.0.12版本。但我想使用扩展 yiisoft/yii-queue。 当我 运行 命令 composer require yiisoft/yii-queue 安装此扩展时,此抛出消息需要将 Yii 版本更新到 2.0.14 才能使用 yiisoft/yii-queue

所以,我运行命令composer require "yiisoft/yii2:~2.0.14" --update-with-all-dependencies更新Yii版本,但是遇到这个命令的消息是:


  Problem 1
    - Can only install one of: yiisoft/yii2[2.0.14, dev-master].
    - Can only install one of: yiisoft/yii2[2.0.14.1, dev-master].
    - Can only install one of: yiisoft/yii2[2.0.14.2, dev-master].
    - Can only install one of: yiisoft/yii2[2.0.15, dev-master].
    - Can only install one of: yiisoft/yii2[2.0.15.1, dev-master].
    - Installation request for yiisoft/yii2 dev-master -> satisfiable by yiisoft/yii2[dev-master].
    - Installation request for yiisoft/yii2 ~2.0.14 -> satisfiable by yiisoft/yii2[2.0.14, 2.0.14.1, 2.0.14.2, 2.0.15, 2.0.15.1].


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

这是我的 composer.json

 {
    "name": "yiisoft/yii2",
    "description": "Yii 2 Advanced Project Template",
    "keywords": ["yii2", "framework", "advanced", "project template"],
    "homepage": "http://www.yiiframework.com/",
    "type": "project",
    "license": "BSD-3-Clause",
    "support": {
        "issues": "https://github.com/yiisoft/yii2/issues?state=open",
        "forum": "http://www.yiiframework.com/forum/",
        "wiki": "http://www.yiiframework.com/wiki/",
        "irc": "irc://irc.freenode.net/yii",
        "source": "https://github.com/yiisoft/yii2"
    },
    "minimum-stability": "stable",
    "require": {
        "php": ">=5.6.0",
        "yiisoft/yii2": ">=2.0.6",
        "yiisoft/yii2-bootstrap": "*",
        "yiisoft/yii2-swiftmailer": "*",
        "yiisoft/yii2-authclient": "*",
        "zhelyabuzhsky/yii2-sitemap": "*",
        "phpoffice/phpexcel":"*",
        "intervention/image": "^2.1",
        "facebook/graph-sdk": "^5.7",
        "vlucas/phpdotenv": "^3.1",
        "trntv/probe": "^1.0",
        "philippfrenzel/yii2fullcalendar": "^3.9"
    },
    "require-dev": {
        "yiisoft/yii2-codeception": "*",
        "yiisoft/yii2-debug": "*",
        "yiisoft/yii2-gii": "*",
        "yiisoft/yii2-faker": "*"
    },
    "extra": {
        "asset-installer-paths": {
            "npm-asset-library": "vendor/npm",
            "bower-asset-library": "vendor/bower"
        }
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://asset-packagist.org"
        }
    ],
    "scripts": {
        "post-install-cmd": "php init --env=Development --overwrite=n"
    }
}

在这种情况下,谁能帮我升级 yii 版本,我尝试搜索了很多次和页面,但没有找到适合我的解决方案:(

非常感谢。

您需要更改项目名称。根据您的 composer.json,您的项目是 yiisoft/yii2,这是不正确的。我不知道你是怎么得到这个 composer.json, here is the official template - your app structure and composer.json should look similar (alternatively you may try advanced template) 的。更改包名称后,此命令应该可以解决问题:

composer require yiisoft/yii2-queue --update-with-all-dependencies