这篇文章主要为大家展示了“Composer安装及更新YII2框架会遇到什么问题”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“Composer安装及更新YII2框架会遇到什么问题”这篇文章吧。
前置条件
首先使用Composer包工具的需要满足以下两个前提,不区分操作系统。
1 电脑需要安装Composer包管理工具,并且全局可直接使用
2 安装Composer Asset插件,Asset插件需要合适的版本。
两个条件在安装的同时,都必须注意合适的版本。以下附上Mac安装composer和插件的主要步骤
curl -sS https://getcomposer.org/installer | php
All settings correct for using Composer
Downloading...
Composer (version 1.8.0) successfully installed to: /Users/wangmingming/composer.phar
Use it: php composer.phar
将composer 设置为全局可用
mv composer.phar /usr/local/bin/composer
安装完Composer,运行下面的命令来安装Composer Asset插件
This command installs the composer asset plugin which allows managing bower and npm package dependencies through Composer.
查阅网络很多资料, Asset插件相关的问题主要集中在【安装Composer Asset插件老是失败】,解决方案都是给出执行具体的命令,安装这个插件的关键在于 确定当时fxp/composer-asset-plugin组件的最新版本,然后再安装。
查看composer-asset-plugin最新版本
https://packagist.org/packages/fxp/composer-asset-plugin
执行如下命令安装
composer global require "fxp/composer-asset-plugin:~1.4.4"
Changed current directory to /Users/path/.composer.
/composer.json has been updatedLoading composer repositories with package information
Updating dependencies (including require-dev)Package operations: 0 installs, 1 update, 0 removals - Updating fxp/composer-asset-plugin (v1.2.2 => v1.4.4): Loading from cache
Writing lock fileGenerating autoload files
服务器部署YII2 2.0.6,采用PHP7.2 报错
For compatibiliy with [PHP 7.2 which does not allow classes to be named `Object` anymore](https://wiki.php.net/rfc/object-typehint), we needed to rename `yii\base\Object` to `yii\base\BaseObject`. `yii\base\Object` still exists for backwards compatibility and will be loaded if needed in projects that are running on PHP <7.2. The compatibility class `yii\base\Object` extends from `yii\base\BaseObject` so if you have classes that extend from `yii\base\Object` these would still work. What does not work however will be code that relies on `instanceof` checks or `is_subclass_of()` calls for `yii\base\Object` on framework classes as these do not extend `yii\base\Object` anymore but only extend from `yii\base\BaseObject`. In general such a check is not needed as there is a `yii\base\Configurable` interface you should check against instead.
更新YII2 框架至2.0.14 遇到问题
Problem 1 - yiisoft/yii2 2.0.15.1 requires bower-asset/inputmask ~3.2.2 | ~3.3.5 -> no matching package found. - yiisoft/yii2 2.0.15 requires bower-asset/inputmask ~3.2.2 | ~3.3.5 -> no matching package found. - yiisoft/yii2 2.0.14.2 requires bower-asset/inputmask ~3.2.2 | ~3.3.5 -> no matching package found. - yiisoft/yii2 2.0.14.1 requires bower-asset/inputmask ~3.2.2 | ~3.3.5 -> no matching package found. - yiisoft/yii2 2.0.14 requires bower-asset/inputmask ~3.2.2 | ~3.3.5 -> no matching package found. - 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].
简单理解为设置程序远程更新包时的访问token,在github处于登录状态时,生成token,就可以畅通的下载 形如https://api.github.com/repos/ 这样的包文件了。
以上是“Composer安装及更新YII2框架会遇到什么问题”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。