本文主要记录整理经常使用到的 composer 命令,以便后期查看
composer 查看版本
composer --version
composer 更新升级到指定版本
composer self-update --2
#或
composer self-update --1
composer 版本回退命令
composer self-update --rollback
composer 快速安装更新版本
使用一下命令会自动创建 composer.json
composer require 库名 [版本号]
composer 安装时展示详情
composer require 库名 [版本号] -vvv
composer 初始化开发新包
composer init
composer 手动新增配置安装
手动新增 composer.json 文件,然后执行安装
composer install
composer 移除第三方包
composer remove xxxx/xxxx
composer 更新所有依赖
根据 composer.json 中的配置更新所有依赖包
composer update
composer 更新指定的包
composer update xxx/xxx
composer 批量更新多个指定包
composer 批量更新多个指定包,可以使用通配符
composer update xxx/xxx xxx/*
composer 搜索第三方包
composer search xxx
composer 展示所有已经安装的包
composer show
- 可以通过通配符进行筛选
composer show xxx/*
composer 显示具体某个包的信息
composer show monolog/monolog
composer 从现有的包里创建一个新的项目
composer create-project
- 如:composer create-project
topthink/think=5.0.* tp5 --prefer-dist
composer 配置命令
composer config
composer 导入包自动加载优化
composer dump-autoload --optimize
composer 多线程下载安装
composer global require hirak/prestissimo
关于 composer常用命令 统计整理完毕,如有不全后期陆续更新。