php composer 配置

composer 配置

阿里云 Composer 全量镜像

https://developer.aliyun.com/composer
https://www.cnblogs.com/abcdefghi123/p/15670845.html

换http源,更改配置不要使用https加密连接

composer config -g repo.packagist composer http://packagist.phpcomposer.com
composer config -g secure-http false

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

诊断

composer diagnose

compose 安装

curl -sS https://getcomposer.org/installer | php  # 安装
mv composer.phar /usr/local/bin/composer  #将composer.phar文件移动到bin目录以便全局使用composer命令
composer config -g repo.packagist composer https://packagist.phpcomposer.com  #切换国内源

composer  # 验证

# 常用操作
/usr/bin/composer update
/usr/bin/composer install
php -d memory_limit=-1 /usr/bin/composer install

多个php版本的composer使用

wget https://getcomposer.org/download/1.6.5/composer.phar
composer update     # 更新
composer require laravel/passport   # 默认php版本拉取包
php72 composer.phar require laravel/passport  # 指定版本拉取包

镜像源

https://tool.lu/pkg/
https://learnku.com/articles/15977/composer-accelerate-and-modify-mirror-source-in-china

# 查看源
composer config -l -g | grep repositories.packagist.org.url
composer.json 中可以指定源位置(优先级别?)

# 修改源
composer config repo.packagist composer https://packagist.phpcomposer.com
composer config -g repo.packagist composer https://packagist.phpcomposer.com
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
composer config -g repo.packagist composer https://mirrors.huaweicloud.com/repository/php/

Composer 如何卸载某个扩展或者删除某个包

composer remove  phpoffice/phpexcel
composer remove topthink/think-view topthink/think-captcha
cat composer.json   # 发现包删除了
posted @ 2022-03-30 18:24  AlexG  阅读(248)  评论(0编辑  收藏  举报