1. Use composer country image
Global configuration:
composer config -g repo.packagist composer https://packagist.phpcomposer.com
Individual project configuration:
composer config repo.packagist composer https://packagist.phpcomposer.com
Recommended tutorial:yii framework
2. Delete the default warehouse configuration in composer.json
3. Solve the bower dependency
composer require yidas/yii2-bower-asset
Then we saw that the dependencies started to be installed. The main reason for composer installation failure was that the default warehouse access was very slow. If we directly use the national image, we need to solve the bower dependency.
4. Modify bower configuration: config/web.php, point the alias to @vendor/yidas/yii2-bower-asset/bower
If there is no configuration key, you need to add a key in 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', ], ... ]
For more programming related content, please pay attention to the php Chinese websiteProgramming IntroductionColumn!
The above is the detailed content of What should I do if composer fails to install yii?. For more information, please follow other related articles on the PHP Chinese website!