Composer 源管理工具 CRM 以及各大厂商镜像地址

CRM - Composer源管理工具

由于composer在国内下载速度非常慢,大家都习惯使用中国镜像,如果正在使用的镜像没有更新或者出现故障你可以使用Composer Registry Manager帮助你轻松地切换到另外一个镜像。
默认带了一些镜像,当然你也可以添加新的镜像。

安装

使用composer安装,执行下面命令

$ composer global require slince/composer-registry-manager

基本用法

列出所有可使用的镜像

$ composer repo:ls

 --- ---------- ------------------------------------------------
      composer   https://packagist.org
  *   aliyun     https://mirrors.aliyun.com/composer
      tencent    https://mirrors.cloud.tencent.com/composer
      huawei     https://mirrors.huaweicloud.com/repository/php
      cnpkg      https://php.cnpkg.org
      sjtug      https://packagist.mirrors.sjtug.sjtu.edu.cn
 --- ---------- ------------------------------------------------

标“*”表示当前正在使用的源;

切换镜像

$ composer repo:use

Please select your favorite repository (defaults to composer) [composer]:
  [0] composer
  [1] aliyun
  [2] tencent
  [3] huawei
  [4] cnpkg
  [5] sjtug
>

你也可以直接追加镜像名称来跳过选择

$ composer repo:use aliyun

添加选项 --current/-c 为当前项目切换源,默认是修改全局的源。

所有命令

执行下面命令查看

$ composer repo
  _____   _____        ___  ___
 /  ___| |  _  \      /   |/   |
 | |     | |_| |     / /|   /| |
 | |     |  _  /    / / |__/ | |
 | |___  | | \ \   / /       | |
 \_____| |_|  \_\ /_/        |_|
 
 Composer Repository Manager version 2.0.0
 
 Usage:
   command [options] [arguments]
 
 Options:
   -h, --help            Display this help message
   -q, --quiet           Do not output any message
   -V, --version         Display this application version
       --ansi            Force ANSI output
       --no-ansi         Disable ANSI output
   -n, --no-interaction  Do not ask any interactive question
   -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
 
 Available commands for the "repo" namespace:
   repo:add     Creates a repository
   repo:ls      List all available repositories
   repo:remove  Remove a repository
   repo:use     Change current repository

附添加第三方源

使用阿里巴巴提供的 Composer 全量镜像 https://mirrors.aliyun.com/composer/

a). 配置只在当前项目生效
composer config repo.packagist composer https://mirrors.aliyun.com/composer/

取消当前项目配置

composer config --unset repos.packagist
b). 配置全局生效
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

取消全局配置

composer config -g --unset repos.packagist

各大厂商镜像地址

阿里云

    https://mirrors.aliyun.com/composer/

华为云

        https://mirrors.huaweicloud.com/repository/php/   

腾讯云

        https://mirrors.cloud.tencent.com/composer/

cnpkg

 https://php.cnpkg.org

phpcomposer

        https://packagist.phpcomposer.com

交通大学

 https://packagist.mirrors.sjtug.sjtu.edu.cn

非特殊说明,本博所有文章均为博主原创。

备注:相关侵权、举报、投诉及建议等,请联系站长

添加新评论

昵称
邮箱
网站