1、使用composer國區(qū)鏡像
全局配置:
composer config -g repo.packagist composer https://packagist.phpcomposer.com
項目單獨配置:
composer config repo.packagist composer https://packagist.phpcomposer.com
推薦教程:yii框架
2、刪除composer.json中默認(rèn)的倉庫配置
3、解決bower依賴
composer require yidas/yii2-bower-asset
然后我們看到依賴開始安裝, composer安裝失敗的主要原因是默認(rèn)的倉庫訪問很慢, 直接使用國區(qū)鏡像, 需要解決bower依賴。
4、修改bower配置: config/web.php, 將別名指向@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', ], ... ]