Usage:
There are two ways to enable this mirror service:
In order to avoid executing two queries when installing the package, remember to add the setting to disable packagist, as follows:
{ "repositories": [ {"type": "composer", "url": "http://pkg.phpcomposer.com/repo/packagist/"}, {"packagist": false} ] }
View the composer home directory: The global configuration information of composer can be listed through the composer config -l -g
command, and the [home]
configuration item found in this information is the home directory of composer. Linux users please execute the sudo composer config -l -g
command.
Enter the composer's home directory, open the config.json file (if it doesn't exist, create one yourself), and then add the configuration information of this mirror service. The final content is as follows:
{ "config": { }, "repositories": [ {"type": "composer", "url": "http://pkg.phpcomposer.com/repo/packagist/"}, {"packagist": false} ] }
{ "name": "laravel/laravel", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], "license": "MIT", "type": "project", "require": { "laravel/framework": "4.2.*" }, "autoload": { "classmap": [ "app/commands", "app/controllers", "app/models", "app/database/migrations", "app/database/seeds", "app/tests/TestCase.php" ] }, "scripts": { "post-install-cmd": [ "php artisan clear-compiled", "php artisan optimize" ], "post-update-cmd": [ "php artisan clear-compiled", "php artisan optimize" ], "post-create-project-cmd": [ "php artisan key:generate" ] }, "config": { "preferred-install": "dist" }, "minimum-stability": "stable", "repositories": [ {"type": "composer", "url": "http://pkg.phpcomposer.com/repo/packagist/"}, {"packagist": false} ] }
The above introduces how to change the configuration of the domestic mirror website if the composer update is unsuccessful, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.