Dependency management tool

Composer as a dependency package management tool

Make sure you have PHP and Composer installed before using it.

Use domestic source

Method 1: Modify the global configuration

Open the terminal and execute the following command:

 composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
// OR
composer config -g repo.packagist composer https://mirrors.huaweicloud.com/repository/php/ 

Method 2: Modify the project configuration

Open the terminal and go to the root directory of your project (that is, the directory where the composer.json file is located). Execute the following command:

 composer config repo.packagist composer https://mirrors.aliyun.com/composer/
// OR
composer config repo.packagist composer https://mirrors.huaweicloud.com/repository/php/ 

You can also manually add the following to composer.json:

 "repositories": {
    "packagist": {
        "type": "composer",
        "url": "https://mirrors.aliyun.com/composer/"
    }
} 

Related URL

/docs/2.x/en/ready/composer.html
progress-bar