时间:2021-07-01 10:21:17 帮助过:26人阅读
有两种方式启用本镜像服务:
为了避免安装包的时候都要执行两次查询,切记要添加禁用 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教程有兴趣的朋友有所帮助。