composer简介
composer是一款PHP依赖管理工具,类似于node.js的npm,java的maven,gradle等等。如果在一个PHP项目中一些库依赖于其他库,就声明所依赖的库,Composer 就会找出相应版本的包并安装,默认情况下下载到项目的某个目录中(例如 vendor)进行安装。使用 Composer 可以很轻松的使用一个命令将其他人的优秀代码引用到我们的项目中来。
windows系统怎么安装composer
打开 https://getcomposer.org/download/ ,下载composer-setup,点击“下一步”,过程中会要选择PHP路径,选到php.exe即可。
直接敲入 composer,检查是否安装成功
熟悉了上面的英文,也就熟悉了composer应用场景中90%,一起来看看
______
/ ____/___ ____ ___ ____ ____ ________ _____
/ / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
/_/
Composer version 2.5.5 2023-03-21 11:50:05
Usage:
// 命令 选项 参数
command [options] [arguments]
// 选项
Options:
---help 帮助信息
-h, --help Display help for the given command. When no command is given display help for the list command
---quiet 安静模式 不输出任何信息
-q, --quiet Do not output any message
---version 显示当前版本
-V, --version Display this application version
---ansi 强制 ansi输出
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
---no interation 不要问任何交互问题
-n, --no-interaction Do not ask any interactive question
---profile 展示计时和内存使用信息
--profile Display timing and memory usage informatio
---no plugins 禁用插件
--no-plugins Whether to disable plugins.
---跳过composer.json里所有脚本执行
--no-scripts Skips the execution of all scripts defined in composer.json file.
---working-dir 使用指定的工作目录
-d, --working-dir=WORKING-DIR If specified, use the given directory as working directory.
---no cache 禁用缓存
--no-cache Prevent use of the cache
---verbose 增加信息曝光 vvv表示debug
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands:
--about 显示composer简短介绍
about Shows a short information about Composer
--archive 创建composer包的归档
archive Creates an archive of this composer package
--audit 检查已安装包的安全建议
audit Checks for security vulnerability advisories for installed packages
--browse 在浏览器打开包的仓库地址或者首页
browse [home] Opens the package's repository URL or homepage in your browser
--bump 提升composer.json最低要求版本为已安装版本
bump Increases the lower limit of your composer.json requirements to the currently installed versions
--check-platform-reqs 检查平台要求是否已满足
check-platform-reqs Check that platform requirements are satisfied
--clear cache 清理缓存
clear-cache [clearcache|cc] Clears composer's internal package cache
--completion 转储脚本
completion Dump the shell completion script
--config 设置配置选项
config Sets config options
--create-project 创建项目
create-project Creates new project from a package into given directory
--depends 展示哪项依赖决定的当前包安装
depends [why] Shows which packages cause the given package to be installed
--diagnose 诊断系统,识别常见错误
diagnose Diagnoses the system to identify common errors
--dump autoload 转储自动加载
dump-autoload [dumpautoload] Dumps the autoloader
--exec 执行供应的二进制编码
exec Executes a vendored binary/script
--fund 如何自助依赖?
fund Discover how to help fund the maintenance of your dependencies
--global 允许全局运行命令
global Allows running commands in the global composer dir ($COMPOSER_HOME)
--help 展示命令的帮助
help Display help for a command
--init 当前目录创建composer.json文件
init Creates a basic composer.json file in current directory
--install 从composer.lock安装项目,没有composer.lock就以composer.json为准
install [i] Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json
--licenses 展示依赖的licenses信息
licenses Shows information about licenses of dependencies
--list列举命令
list List commands
--outdated 展示可以更新的依赖包,以及最新的版本号
outdated Shows a list of installed packages that have updates available, including their latest version
--prohibits 冲突展示,展示哪些已安装的依赖包阻止特定依赖包
prohibits [why-not] Shows which packages prevent the given package from being installed
--reinstall 卸载、重装指定的依赖包
reinstall Uninstalls and reinstalls the given package names
--remove 从require或者require-dev移除包
remove Removes a package from the require or require-dev
--require 添加依赖包到composer.json配置文件,并且安装依赖包
require [r] Adds required packages to your composer.json and installs them
--run script 运行composer.json里的脚本
run-script [run] Runs the scripts defined in composer.json
--search 查找依赖包
search Searches for packages
--selfupdate 更新composer.phar到最新版本
self-update [selfupdate] Updates composer.phar to the latest version
--show 展示依赖包的信息
show [info] Shows information about packages
--status 展示本地修改的依赖包的列表
status Shows a list of locally modified packages
--suggests 展示依赖包的建议
suggests Shows package suggestions
--update 参照composer.json配置更新依赖包到最新版,并且更新composer.json文件
update [u|upgrade] Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file
--validate 验证composer.json和composer.lock文件
validate Validates a composer.json and composer.lock