yii2 php7,Yii2.0.12升级到PHP7.2可用版本

先说一下Yii框架PHP运行环境的情况。

Yii2.0.12版本使用\yii\base\Object类,Object作为类名PHP7.2报错。

PHP7.2的Yii2最小可用版本为2.0.13。

提供若干升级的方法。

项目使用Composer管理bower和npm前端资源。

安装最新版composer-asset-plugin

composer global require "fxp/composer-asset-plugin"

指定类库更新

composer update yiisoft/yii2 yiisoft/yii2-composer bower-asset/jquery.inputmask

Composer记录如下

Loading composer repositories with package information

Updating dependencies (including require-dev)

Reading bower.json of bower-asset/yii2-pjax (2.0.7.1)GitHub API limit (60 calls/hr) is exhausted, could not fetch https://api.github.com/repos/yiisoft/jquery-pjax/commits/aef7b953107264f00234902a3880eb50dafc48be. Create a GitHub OAuth token to go over the API rate limit. You can also wait until 2019-02-15 18:54:52 for the rate limit to reset.

Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+bw-hz-dev-v14+2019-02-15+1755

to retrieve a token. It will be stored in "/data/home/hanguangchao/.config/composer/auth.json" for future use by Composer.

Token (hidden):

Package operations: 1 install, 2 updates, 1 removal

- Removing bower-asset/jquery.inputmask (3.3.7)

- Updating yiisoft/yii2-composer (2.0.5 => 2.0.7): Loading from cache

- Installing bower-asset/inputmask (3.3.11): Downloading (100%)

- Updating yiisoft/yii2 (2.0.12 => 2.0.16): Loading from cache

Writing lock file

Generating autoload files

项目配置不通过Composer管理bower和npm的资源

如果你的Yii2做接口应用、微框架,不需要JS,CSS,或自行管理前端资源,在安装更新的时候可以移除对bower和npm的资源的依赖。

修改composer.json

"require" : {

"yiisoft/yii2": "2.0.16"

},

"replace": {

"bower-asset/inputmask": ">=3.2.0"

}

按需升级

composer update yiisoft/yii2 yiisoft/yii2-composer bower-asset/jquery.inputmask

如果有报错,一般都是前端资源依赖问题,移除即可。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值