Backend Development 3 min read

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.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
Configuring Composer Mirrors for Alibaba Cloud, Tencent Cloud, Huawei Cloud, and Other Chinese Repositories

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.packagist

Project‑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.packagist

Debugging

Increase verbosity with -vvv to see detailed output, e.g.:

composer -vvv require alibabacloud/sdk

Common 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.

BackendconfigurationPHPComposerPackage Managementmirrors
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.