Home >Development Tools >composer >Teach you how to configure composer China full image
The following tutorial column of composer will introduce to you the configuration of composer China full image. I hope it will be helpful to friends who need it!
Because the composer installation package data is downloaded from github.com, the elements of the installation package The data is downloaded from packagist.org
As two foreign websites, the connection speed will be very slow, and it is very likely that the website will be blocked.
So composer China full image caches the installation package data and installation package metadata to the domestic computer room, and accelerates it through the domestic CDN,
In this way, we don’t have to request foreign websites when accessing Initiate a request, thus increasing the access speed.
So how do we use composer China full image?
First you can check the current address:
$ composer config -g repo.packagist
If the above error is reported, you can follow the prompts to add the -l parameter to view
$ composer config -g -l repo.packagist
You can see that the current mirror address is packagist.org. This is a foreign website, so every time you use composer, it is very slow.
We use the following command
$ composer config -g repo.packagist composer https://packagist.phpcomposer.com
to change the composer’s mirror address to the domestic address of https://packagist.phpcomposer.com
Check again after changing it
You can see that the mirror address has been changed. At this time, you can experience the speed of composer!
The above belongs to the image of system global configurationcomposer. If you only want to configure a project individually, enter the directory folder, execute
composer config repo.packagist composer https://packagist.phpcomposer.com
, that is, without the -g parameter. This command can modify the composer.json configuration file in the current folder and modify the composer image of the current project.
Add the above command to the composer.json file
"repositories": { "packagist": { "type": "composer", "url": "https://packagist.phpcomposer.com" } }
You can also manually add the above content to complete the configuration.
The above is the detailed content of Teach you how to configure composer China full image. For more information, please follow other related articles on the PHP Chinese website!