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

藏色散人
Release: 2021-07-27 16:52:12
forward
3387 people have browsed it

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/
Copy after login

1.2 Use in individual projects

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

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"
         }
    ]}
Copy after login

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"
         }
    }}
Copy after login

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!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template