欢迎各位兄弟 发布技术文章
这里的技术是共享的
有两种方式启用本镜像服务:
为了避免安装包的时候都要执行两次查询,切记要添加禁用 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} ] } 来自 http://blog.csdn.net/naola2001/article/details/46612023