Home >Development Tools >composer >How to configure composer repositories warehouse? What are the mirror sources?

How to configure composer repositories warehouse? What are the mirror sources?

藏色散人
藏色散人forward
2021-07-27 16:52:123452browse

composer repositories warehouse configuration

##1. Configuration method

1.1 Command line configuration Taking Alibaba Cloud as an example, global mode (recommended):

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

1.2 Use in individual projects

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

2. Modify file configuration

There are two ways to write it

2.1 Array method [ ] is an array method, search in order

{
    "repositories": [
         {
             "type": "composer",
             "url": "http://packages.foo.com"
         }
    ]}

2.2 Object method { } Object method: Use JSON object representation. However, JSON key/value correspondences are considered unordered, so consistent behavior cannot be guaranteed. So what are the advantages of using the object approach?

{
    "repositories": {
         "foo": {
             "type": "composer",
             "url": "http://packages.foo.com"
         }
    }}

Official Document (https://getcomposer.org/doc/04- schema.md#repositories)

3. Image source

Alibaba Cloud Composer full image (recommended) Image type: full image
Update time: 1 minute
Mirror address: https://mirrors.aliyun.com/composer/
Official address: https://mirrors.aliyun.com/composer/index.html
Mirror description: Alibaba Cloud CDN Acceleration, fast update speed, it is recommended to use

Anchang Network Mirror Mirror type: Full mirror
Update time: 1 minute
Mirror address: https:// php.cnpkg.org
Official address: https://php.cnpkg.org/
Image description: This Composer image is sponsored by Anchang Network and currently supports full proxying of metadata and download packages.

Jiaotong University Mirror Mirror type: non-full mirror
Mirror address: https://packagist.mirrors.sjtug.sjtu.edu.cn/
Official Address: https://mirrors.sjtug.sjtu.edu.cn/packagist/
Mirror description: The composer mirror provided by Shanghai Jiao Tong University is a stable, fast, and modern mirror service. It is recommended to use.

Laravel China Mirror (deprecated) Mirror type: full mirror
Update time: 10 minutes
Mirror address: https://packagist.laravel-china. org
For more composer-related technical articles, please visit the
composer tutorial column!

The above is the detailed content of How to configure composer repositories warehouse? What are the mirror sources?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete