[TOC] #### 1. 前言 --- 當(dāng)我們使用 composer 安裝軟件包時是從遠程的國外服務(wù)器下載的,但國內(nèi)用戶訪問國外服務(wù)器會比較慢,甚至不能訪問 國內(nèi)某些知名機構(gòu)將國外的軟件同步到了國內(nèi)服務(wù)器,將 composer 下載擴展包用的服務(wù)器指向這個國內(nèi)服務(wù)器,就可以實現(xiàn)快速下載擴展包了。本文列舉一些最常用的國內(nèi)鏡像 #### 2. 配置鏡像源 --- [Composer 中文網(wǎng)](https://pkg.phpcomposer.com/#how-to-use-packagist-mirror) ```bash composer config -g repo.packagist composer https://packagist.phpcomposer.com ``` [阿里云 Composer 鏡像](https://developer.aliyun.com/composer) ```bash composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ ``` [騰訊云 Composer 鏡像](https://mirrors.cloud.tencent.com/help/composer.html) ```bash composer config -g repos.packagist composer https://mirrors.cloud.tencent.com/composer/ ``` #### 3. 恢復(fù)默認鏡像源 --- 刪除全局鏡像配置 ```bash # 取消全局鏡像配置,使用默認的 https://repo.packagist.org composer config -g --unset repo.packagist ``` #### 4. 查看當(dāng)前鏡像源 --- 查看當(dāng)前全局使用的鏡像 ```bash composer config -gl composer config -gl | grep repositories.packagist.org.url ``` ![](https://img.itqaq.com/art/content/1dc19b73ae00b490d3c75cea3c01c962.png)