0%

composer常用命令

检查更新

1
composer selfupdate

切换中国镜像

1
2
3
composer config -g repo.packagist composer https://packagist.phpcomposer.com    # phpcomposer镜像         已停用
composer config -g repo.packagist composer https://packagist.laravel-china.org # Laravel China镜像 已停用
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer # 阿里云Composer全量镜像 建议使用

解除镜像并恢复到packagist官方源

1
composer config -g --unset repos.packagist

仅更新单个库

1
composer update foo/bar

全局安装

1
composer global require foo/bar

全局更新

1
composer global update

composer autoload 自动加载性能优化

1
composer dump-autoload -o