用法:
有兩種方式啟用本鏡像服務:
為了避免安裝套件的時候都要執行兩次查詢,切記要新增停用packagist 的設置,如下:
{ "repositories": [ {"type": "composer", "url": "http://pkg.phpcomposer.com/repo/packagist/"}, {"packagist": false} ] }
查看composer 主目錄:透過 composer config -l -g
指令可以列出composer 的全域設定訊息,在這些訊息中尋找 [home]
設定項目就是composer 的主目錄。 Linux 使用者請執行 sudo composer config -l -g
指令。
進入composer 的主目錄,打開config.json 文件(如果沒有就自己創建一個),然後增加本鏡像服務的配置信息,最終內容如下:
{ "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} ] }
以上就介紹了composer更新不成功,啟用國內鏡像網站的配置更改辦法,包括了方面的內容,希望對PHP教程有興趣的朋友有所幫助。