logo头像

迪拜 ❤ 天空

composer

composer

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
下载安装脚本 - composer-setup.php - 到当前目录

php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');"

//执行安装过程

php composer-setup.php

//删除安装脚本

php -r "unlink('composer-setup.php');"

//将命令添加到全局

sudo mv composer.phar /usr/local/bin/composer
//换源
composer config -g repo.packagist composer https://packagist.phpcomposer.com

#Composer 镜像卡顿问题

1
2
3
4
5
# 1. curl 命令方法
curl http://ipv4.icanhazip.com

# 2. 或者 php
php -r "readfile('http://ipv4.icanhazip.com');"

#Composer 镜像地址

1
2
3
4
5
6
7
8
9
10
11
12
13
阿里云

使用说明:https://mirrors.aliyun.com/composer/

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

华为云

composer config -g repo.packagist composer https://mirrors.huaweicloud.com/repository/php/

腾讯云

composer config -g repos.packagist composer https://mirrors.cloud.tencent.com/composer/

#Composer 自动加载

在composer.json 文件中配置类和命名空间

配置好 composer.json 文件,并执行 compoer install

通过 composer.json 文件配合 composer update 和 composer dump-autoload 命令实现这些功能

评论系统未开启,无法评论!