Configuring Composer Mirrors for Alibaba Cloud, Tencent Cloud, Huawei Cloud, and Other Chinese Repositories
This guide lists common Chinese Composer mirrors, shows how to set a global or project‑specific mirror with Composer commands, provides debugging tips, and outlines troubleshooting steps such as updating Composer, running diagnostics, clearing caches, and refreshing the lock file.
Composer Mirrors Overview
Composer is essential for PHP developers, but using it in China can encounter connectivity issues, so many domestic mirrors are available.
Available Mirrors
Alibaba Cloud Composer Mirror – https://developer.aliyun.com/composer
Tencent Cloud Composer Mirror – https://mirrors.cloud.tencent.com/composer/
Huawei Cloud Composer Mirror – https://mirrors.huaweicloud.com/repository/php/
Anchang Network Mirror – https://php.cnpkg.org
SJTU Mirror – https://packagist.mirrors.sjtug.sjtu.edu.cn
Packagist JP – https://packagist.jp
Global Configuration (Recommended)
All projects will use the specified mirror address:
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/To remove the global configuration:
composer config --unset repos.packagistProject‑Specific Configuration
Only the current project will use the mirror:
composer config repo.packagist composer https://mirrors.aliyun.com/composer/To cancel the project configuration:
composer config --unset repos.packagistDebugging
Increase verbosity with -vvv to see detailed output, e.g.:
composer -vvv require alibabacloud/sdkCommon Issues & Solutions
Upgrade Composer to the latest version: composer self-update
Run diagnostics: composer diagnose
Clear Composer cache: composer clear
If the project was previously installed from another source, update the composer.lock file: composer update --lock
For more details, refer to the official documentation of each mirror provider.
Laravel Tech Community
Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.