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

时间:2019-01-20 05:17:16

标签: yii2 composer-php yii2-advanced-app yii-extensions yii2-basic-app

当前,我的项目使用的是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版本,我试图搜索很多次和很多页面,但没有适合我的解决方案:(

非常感谢您。

1 个答案:

答案 0 :(得分:0)

您需要更改项目名称。根据您的composer.json,您的项目为yiisoft/yii2,这是不正确的。我不知道您是怎么得到composer.jsonhere is the official template的-您的应用程序结构和composer.json应该看起来很相似(或者您可以尝试advanced template)。更改软件包名称后,此命令应可完成以下操作:

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