Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure composer China full Mirror

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

The editor will share with you how to configure the full image of composer China. I hope you will get something after reading this article. Let's discuss it together.

Principle:

Because the composer installation package data is downloaded from github.com, the metadata for the installation package is downloaded from packagist.org

As two foreign websites, the connection speed will be very slow, and it is very likely that the site will be walled.

Therefore, the full image of composer China caches the installation package data and metadata to the domestic computer room, and accelerates through the domestic CDN.

In this way, we do not have to make requests to foreign websites when we visit, so we improve the speed of the visit.

Configuration:

So how do we use the full image of composer China?

First, take a look at the current address:

$composer config-g repo.packagist

If you report the above error, you can follow the prompt to add the-l parameter to view

$composer config-g-l repo.packagist

You can see that the current image address is packagist.org, which is a foreign website, so it is very slow to use composer every time.

We pass the following order

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

Change the mirror address of composer to the domestic address of https://packagist.phpcomposer.com

Check it again after correcting it

You can see that the mirror address has been changed, and you can experience the flying speed of composer!

Attached:

The above belongs to the image of the system global configuration composer. If you only want to configure a project individually, go to the folder in that directory and 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 under the current folder and modify the composer image of the current project.

The above command is added to the composer.json file

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

You can also manually add the above to complete the configuration.

After reading this article, I believe you have a certain understanding of "how to configure composer China full Image". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report