composer modified to mirror the country

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/qq_41399976/article/details/100699999

Because the installation package composer data is downloaded from the github.com source data downloaded from the installation package packagist.org

As the two foreign websites, the connection speed will be very slow, but the site is likely to be a wall.

Therefore, the total amount of Chinese composer mirrored data package will be installed and the installation package metadata cache to domestic engine room, and accelerated through domestic CDN,

So we do not initiate a request to access to foreign websites, so to enhance the speed of access.

Configuration:

So how do we use the whole amount of Chinese composer mirror it?

First, you can look at current address:

$ composer config -g repo.packagist

If the message above error, you can view and follow the prompts to add the -l option

$ composer config -g -l repo.packagist

You can see the current mirror address is packagist.org This is a foreign site, so each time you use composer when very slow.

We configured Ali cloud images using the following command

$ composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

The composer's address to https://mirrors.aliyun.com/composer Ali cloud mirror image

After changing for the better view mirror you can see the address has changed again, this time to experience the speed of flying in general composer friends!
Report: more than part of a mirrored system global configuration composer, if you want to individually configure a project file into the directory folder, perform the composer config repo.packagist composer https://mirrors.aliyun.com/composer/
in composer.json to add a data source can be optimized, access speed.

// When composer.json there are two sources of data, to access first, and then could not find a second visit, in turn, packagist last execution, the implementation of other priority.
"Repositories": {
"packagist": {
"type": "Composer",
"URL": "https://mirrors.aliyun.com/composer/"
},
". 1": {
"type": "Composer" ,
"url": "https://asset-packagist.org"
}

}
Added: Ali has launched a cloud mirror synchronization, configuration method (recommended)
official See: https: //developer.aliyun.com/composer

Guess you like

Origin blog.csdn.net/qq_41399976/article/details/100699999