# 用国内镜像
个人推荐 https://pkg.phpcomposer.com
```
$ composer config -g repo.packagist composer https://packagist.phpcomposer.com
```
# 用国外镜像
```
composer config -g repo.packagist composer https://packagist.org
```
## 备注
用国内镜像输入用户名和密码会报错,如下所示:
C:\xampp\htdocs\laravels>composer updateLoading composer repositories with package information Authentication required (packagist.phpcomposer.com): Username: Password:Invalid credentials for 'https://packagist.phpcomposer.com/packages.json'//后面把https://packagist.phpcomposer.com改成https://https://packagist.org才可以安装依赖成功//目前解决办法:composer config -g repo.packagist composer https://https://packagist.org