1.使用composer国区镜像
全局配置:
composer config -g repo.packagist composer https://packagist.phpcomposer.com
项目单独配置:
composer config repo.packagist composer https://packagist.phpcomposer.com
2.删除composer.json中默认的仓库配置
3.解决bower依赖
composer require yidas/yii2-bower-asset
然后我们看到依赖开始安装, composer安装失败的主要原因是默认的仓库访问很慢, 直接使用国区镜像, 需要解决bower依赖
4.修改bower配置: config/web.php
, 将别名指向@vendor/yidas/yii2-bower-asset/bower
$config = [
...
'aliases' => [
'@bower' => '@vendor/yidas/yii2-bower-asset/bower'
],
...
];
如果没有配置密钥,需要在config/web.php
中加上一个密钥
'components' => [
'request' => [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey' => 'your-key',
],
...
]
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。