如何更新yii2-yii2 composer.json

yii2安装新建项目指南_懒人程序
支付宝赞助帐号:
yii2安装新建项目指南
yii2安装新建项目指南
Windows安装Composer:
一、下载Composer
官网下载:https://getcomposer.org/download/
二、开启PHP的openssl支持
修改php配置文件php.ini
去掉& extension=php_openssl.dll& 前的注释 (;)
(如在wamp中,在扩展中&php_openssl&前打勾, 第三部会提示没有&php_openssl 扩展的支持!原因是)
三、安装Composer
根据提示,一路&next&安装完毕。过程有错搜索一下,几本都能解决!
安装完毕会提示你重新打开CMD命令行使用。
安装Yii2 - advanced&模板
一、下载yii2 - advanced 模板
官网下载:/download/
下载完毕解压至
站点目录( D:\php\www )
二、通过composer安装
打开CMD,跳转到目录
D:\php\www\advanced
练习生成一个名为&yii2web&的项目
等待& &出现如下界面,表示安装成功。
三、初始化项目
在yii2web目录下, 执行CMD命令init
测试安装结果
地址栏输入:http://localhost/yii2web/frontend/web/index.php
1.如看到下图:
看到这个说明已安装成功!
2.报错:Calling unknown method: yii\web\UrlManager::addRules()
& 搜索的都是:在composer.json 里面添加一段话:
&extra&: {&
&&&&&&&&&asset-installer-paths&: {&
&&&&&&&&&&&&&npm-asset-library&:&&vendor/npm&,&
&&&&&&&&&&&&&bower-asset-library&:&&vendor/bower&,&
&&&&&&&&&&&&&npm-searchable&: false,&
&&&&&&&&&&&&&bower-searchable&: false&
&&&&&&&&}&
结果还是报错!所以尝试使用其他方法:
在yii2web目录下,cmd 运行:(图片中 yii2test\yii2test2 换成 yii2web )
1:& composer global require &fxp/composer-asset-plugin:1.0.*@dev&
2:& composer update &( 如若不行第二步请执行&&composer update --dev --try-run &命令,一般composer update 即可 )
中间让输入git帐号密码,按提示网址,注册一个即可!还有其他问题,小弟不才,往读者留言指出,谢谢!
更新结束,刷新浏览器,成功!
支持键盘 ← →Mac安装composer安装Yii2项目
时间: 11:58:02
&&&& 阅读:583
&&&& 评论:
&&&& 收藏:0
标签:&&&&&&&&&&&&&&&&&&&&&&&&&&&【注释:】本人原创,如需转载请注明来源链接!
通过安装Composer方式安装Yii
如果还没有安装 Composer,你可以按&&中的方法安装。 在 Linux 和 Mac OS X 中,你可以运行如下命令:
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
一、打开终端
二、安装composer:
1、终端输入:curl -sS https://getcomposer.org/installer | php
composer安装成功
2、终端输入:mv composer.phar /usr/local/bin/composer
将composer.phar移动到 /usr/local/bin/composer支持全局访问composer命令
3、验证方法:(注意:需要有访问权限,否则会提示没有权限访问)
输入:composer -v
三、安装Yii2
Composer 安装后,切换到一个可通过 Web 访问的目录,执行如下命令即可安装 Yii :
composer global require "fxp/composer-asset-plugin:^1.2.0"
composer create-project --prefer-dist yiisoft/yii2-app-basic basic
1、终端输入:composer global require "fxp/composer-asset-plugin:^1.2.0"
如果你没有安装Gii该过程会提示你是否安装,安装即可(以下个人项目名称cqy,当然也可以修改成自己想要的项目名称)
2、终端输入:composer create-project --prefer-dist yiisoft/yii2-app-basic cqy
如果出现以下提示:
说明你权限不够,输入sudo -s,提供root权限
有了权限之后重新输入命令,当进行到一半的时候发现需要token
token命令的话需要Github账号来获取3、获取token在使用github获取数据的时候,需要注册一个github账户在账户& Account& --&Setting 点击后页面刷新后, 点击 Personal access tokens,& 点击Generate new Token按钮 生成token获取到token后输入即可继续安装,如下:
Token (hidden):
Token stored successfully.
Package operations: 59 installs, 0 updates, 0 removals
- Installing yiisoft/yii2-composer (2.0.5): Downloading (100%)
- Installing swiftmailer/swiftmailer (v5.4.7): Downloading (100%)
- Installing bower-asset/jquery (2.2.4): Downloading (100%)
- Installing bower-asset/yii2-pjax (v2.0.6): Downloading (100%)
- Installing bower-asset/punycode (v1.3.2): Downloading (100%)
- Installing cebe/markdown (1.1.1): Downloading (100%)
- Installing ezyang/htmlpurifier (v4.9.2): Downloading (100%)
- Installing bower-asset/jquery.inputmask (3.3.5):Downloading (100%)
- Installing yiisoft/yii2 (2.0.11.2): Downloading (100%)
- Installing yiisoft/yii2-swiftmailer (2.0.6): Downloading (100%)
- Installing bower-asset/bootstrap (v3.3.7): Downloading (100%)
- Installing yiisoft/yii2-bootstrap (2.0.6): Downloading (100%)
- Installing yiisoft/yii2-debug (2.0.9): Downloading (100%)
- Installing bower-asset/typeahead.js (v0.11.1): Downloading (100%)
- Installing phpspec/php-diff (v1.1.0): Downloading (100%)
- Installing yiisoft/yii2-gii (2.0.5): Downloading (100%)
- Installing fzaninotto/faker (v1.6.0): Downloading (100%)
- Installing yiisoft/yii2-faker (2.0.3): Downloading (100%)
- Installing psr/log (1.0.2): Downloading (100%)
- Installing symfony/debug (v3.2.7): Downloading (100%)
- Installing symfony/polyfill-mbstring (v1.3.0): Downloading (100%)
- Installing symfony/console (v3.2.7): Downloading (100%)
- Installing stecman/symfony-console-completion (0.7.0): Downloading (100%)
- Installing sebastian/diff (1.4.1): Downloading (100%)
- Installing sebastian/recursion-context (2.0.0): Downloading (100%)
- Installing sebastian/exporter (2.0.0): Downloading (100%)
- Installing sebastian/comparator (1.2.4): Downloading (100%)
- Installing behat/gherkin (v4.4.5): Downloading (100%)
- Installing symfony/dom-crawler (v3.2.7): Downloading (100%)
- Installing symfony/css-selector (v3.2.7): Downloading (100%)
- Installing symfony/browser-kit (v3.2.7): Downloading (100%)
- Installing symfony/yaml (v3.2.7): Downloading (100%)
- Installing symfony/event-dispatcher (v3.2.7): Downloading (100%)
- Installing symfony/finder (v3.2.7): Downloading (100%)
- Installing psr/http-message (1.0.1): Downloading (100%)
- Installing guzzlehttp/psr7 (1.4.2): Downloading (100%)
- Installing sebastian/version (2.0.1): Downloading (100%)
- Installing sebastian/environment (2.0.0): Downloading (100%)
- Installing sebastian/code-unit-reverse-lookup (1.0.1): Downloading (100%)
- Installing phpunit/php-token-stream (1.4.11): Downloading (100%)
- Installing phpunit/php-text-template (1.2.1): Downloading (100%)
- Installing phpunit/php-file-iterator (1.4.2): Downloading (100%)
- Installing phpunit/php-code-coverage (4.0.8): Downloading (100%)
- Installing sebastian/resource-operations (1.0.0): Downloading (100%)
- Installing sebastian/object-enumerator (2.0.1): Downloading (100%)
- Installing sebastian/global-state (1.1.1): Downloading (100%)
- Installing doctrine/instantiator (1.0.5): Downloading (100%)
- Installing phpunit/phpunit-mock-objects (3.4.3):Downloading (100%)
- Installing phpunit/php-timer (1.0.9): Downloading (100%)
- Installing webmozart/assert (1.2.0): Downloading (100%)
- Installing phpdocumentor/reflection-common (1.0): Downloading (100%)
- Installing phpdocumentor/type-resolver (0.2.1): Downloading (100%)
- Installing phpdocumentor/reflection-docblock (3.1.1): Downloading (100%)
- Installing phpspec/prophecy (v1.7.0): Downloading (100%)
- Installing myclabs/deep-copy (1.6.1): Downloading (100%)
- Installing phpunit/phpunit (5.7.19): Downloading (100%)
- Installing codeception/base (2.2.10): Downloading (100%)
- Installing codeception/verify (0.3.3): Downloading (100%)
- Installing codeception/specify (0.4.6): Downloading (100%)
symfony/console suggests installing symfony/filesystem ()
symfony/console suggests installing symfony/process ()
symfony/browser-kit suggests installing symfony/process ()
symfony/event-dispatcher suggests installing symfony/dependency-injection ()
symfony/event-dispatcher suggests installing symfony/http-kernel ()
phpunit/php-code-coverage suggests installing ext-xdebug (^2.5.1)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
phpunit/phpunit suggests installing ext-xdebug (*)
codeception/base suggests installing flow/jsonpath (For using JSONPath in REST module)
codeception/base suggests installing phpseclib/phpseclib (for SFTP option in FTP Module)
codeception/base suggests installing league/factory-muffin (For DataFactory module)
codeception/base suggests installing league/factory-muffin-faker (For Faker support in DataFactory module)
codeception/base suggests installing symfony/phpunit-bridge (For phpunit-bridge support)
Writing lock file
Generating autoload files
& yii\composer\Installer::postCreateProject
chmod(‘runtime‘, 0777)...done.
chmod(‘web/assets‘, 0777)...done.
chmod(‘yii‘, 0755)...done.
安装成功!
标签:&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&国之画&&&& &&&&chrome插件
版权所有 京ICP备号-2
迷上了代码!yii-advanced composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
- yiisoft/yii2 2.0.9 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -& no matching package found.
- yiisoft/yii2 2.0.8 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable -& no matching package found.
- yiisoft/yii2 2.0.7 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable -& no matching package found.
- yiisoft/yii2 2.0.6 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -& no matching package found.
- yiisoft/yii2 2.0.9 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -& no matching package found.
- Installation request for yiisoft/yii2 &=2.0.6 -& satisfiable by yiisoft/yii2[2.0.6, 2.0.7, 2.0.8, 2.0.9].
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see &https://getcomposer.org/doc/04-schema.md#minimum-stability& for more details.
Read &https://getcomposer.org/doc/articles/troubleshooting.md& for further common problems.
解决方法:
composer global require "fxp/composer-asset-plugin"
再进行更新即可:
您确认要删除此文章吗?Please enter keyword!
JSON syntax error!报错内容如下:
Your requirements could not be resolved to an installable set of packages.
- yiisoft/yii2 2.0.x-dev requires bower-asset/jquery.inputmask ~3.2.2 -& nomatching package found.
- yiisoft/yii2 dev-master requires bower-asset/jquery.inputmask ~3.2.2 -& no matching package found.
- yiisoft/yii2 2.0.7 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable -& no matching package found.
- yiisoft/yii2 2.0.6 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -& no matching package found.
- yiisoft/yii2 2.0.5 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -& no matching package found.
- Installation request for yiisoft/yii2 &=2.0.5 -& satisfiable by yiisoft/yii2[2.0.5, 2.0.6, 2.0.7, dev-master, 2.0.x-dev].
Potential causes: - A typo in the package name - The package is not available in a stable-enough version according to your minimum-stability setting
see &https://getcomposer.org/doc/04-schema.md#minimum-stability& for more details.
Read &https://getcomposer.org/doc/articles/troubleshooting.md& for further common problems.
解决办法有二:
&改变composer.json配置:
&"minimum-stability":&"stable",
替换版本:
将DEV版本替换成稳定版
根据以上两种方式还是报错,我又试了试,方法如下:
1、首先更新composer
& & 执行composer global require "fxp/composer-asset-plugin:~1.1"
2、再进行更新
& & 下面这个过程需要从github获取一个Token
D:\qampp\htdocs\yii2\yii2basic&composer update
Loading composer repositories with package informationUpdating dependencies (including require-dev)Reading bower.json of bower-asset/jquery.inputmask (3.1.34)Could not fetch /repos/RobinHerbots/jquery.inputmask/commits/f48d69e65cc4b5c0b6, please create a GitHub OAuth tokento go over the API rate limitHead to &这里是一个获取Token的网址&to retrieve a token. It will be stored in "C:/Users/Administrator/AppData/Roaming/Composer/auth.json" for future use by Composer.Token (hidden):Token stored successfully.
- Installing yiisoft/yii2-composer (2.0.4)
Downloading: 100%
- Installing ezyang/htmlpurifier (v4.6.0)
Downloading: 100%
- Installing swiftmailer/swiftmailer (v5.4.1)
Downloading: 100%
- Installing bower-asset/jquery (2.2.3)
Downloading: 100%
- Installing bower-asset/yii2-pjax (v2.0.6)
Downloading: 100%
- Installing bower-asset/punycode (v1.3.2)
Downloading: 100%
- Installing bower-asset/jquery.inputmask (3.2.7)
Downloading: 100%
- Installing cebe/markdown (1.1.0)
Downloading: 100%
- Installing yiisoft/yii2 (2.0.7)
Downloading: 100%
- Installing yiisoft/yii2-swiftmailer (2.0.5)
Downloading: 100%
- Installing yiisoft/yii2-codeception (2.0.5)
Downloading: 100%
- Installing bower-asset/bootstrap (v3.3.5)
Downloading: 100%
- Installing yiisoft/yii2-bootstrap (2.0.6)
Downloading: 100%
- Installing yiisoft/yii2-debug (2.0.6)
Downloading: 100%
- Installing bower-asset/typeahead.js (v0.11.1)
Downloading: 100%
- Installing phpspec/php-diff (v1.1.0)
Downloading: 100%
- Installing yiisoft/yii2-gii (2.0.5)
Downloading: 100%
- Installing fzaninotto/faker (v1.5.0)
Downloading: 100%
- Installing yiisoft/yii2-faker (2.0.3)
Downloading: 100%
fzaninotto/faker suggests installing ext-intl (*)Writing lock fileGenerating autoload files
阅读(...) 评论()}

我要回帖

更多关于 yii2 composer 更新慢 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信