Title

Composer

Composer 中文网
使用GitHub. Composer. Packagist管理公开的PHP包(Step By Step)

Ubuntu 安装 Composer

Composer

  • 全局安装
1
2
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

Packagist / Composer 中国全量镜像

1
composer config -g repositories.packagist composer http://packagist.phpcomposer.com

##

1
2
sudo composer clearcache  # 清除缓存
sudo rm -r ~/.composer/cache # 清除缓存

不编辑 composer.json 的情况下安装库

1
composer require "foo/bar:1.0.0"

强制从 github 克隆源代码

1
composer update symfony/yaml --prefer-source

安装 Github phpMyAdmin 执行安装命令

1
2
cd phpMyAdmin
sudo composer install

出现如下错误

1
[Composer\Downloader\TransportException] Your configuration does not allow connection to http://packagist.com. See https://getcomposer.org/doc/06-config.md#secure-http for details
1
2
3
4
5
cd ~/.composer/config.json

"config": {
"secure-http": false
}

使用Composer安装Laravel项目

文章目录
  1. 1. Composer
    1. 1.1. Ubuntu 安装 Composer
    2. 1.2. Packagist / Composer 中国全量镜像
    3. 1.3. 不编辑 composer.json 的情况下安装库
    4. 1.4. 强制从 github 克隆源代码
    5. 1.5. 安装 Github phpMyAdmin 执行安装命令