Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to configure repositories Warehouse in composer

Shulou Source: shulou.com Published: 2022-06-02 06:10:10 10月01日 Update

This article is to share with you about how to configure repositories warehouse in composer, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

1. Configuration mode

1.1 Command Line configuration

Take Aliyun as an example, global mode (recommended):

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

1.2 use of 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 mode

[] is an array way, looking up in order

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

2.2 object mode

{} object mode: use JSON object notation. However, JSON key / value correspondence is considered unordered, so consistent behavior is not guaranteed. So what are the advantages of using the object approach?

{"repositories": {"foo": {"type": "composer", "url": "http://packages.foo.com"} above is how to configure the repositories warehouse in composer. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Tags: Mode configuration object warehouse array more knowledge article utility consistency advantage global writing command that is work meeting file article pattern see Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS OPPO Reno Huawei vpn Microsoft