Linux下全局安装Composer
Composer 是 PHP 用来管理依赖(dependency)关系的工具;你可以在自己的项目中声明所依赖的外部工具库(libraries),Composer 会帮你安装这些依赖的库文件
下面开始安装
1、下载 composer
curl -sS https://getcomposer.org/installer | php
2、将 composer.phar 文件移动到 bin 目录以便全局使用 composer 命令
mv composer.phar /usr/local/bin/composer
3、切换国内阿里云的源,全局配置,即所有项目都会使用该镜像地址
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
取消配置:
composer config -g --unset repos.packagist
4、输入 composer 验证:
Composer version 1.10.7 2020-06-03 10:03:56
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application
version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--profile Display timing and memory usage information
--no-plugins Whether to disable plugins.
-d, --working-dir=WORKING-DIR If specified, use the given directory as working directory.
--no-cache Prevent use of the cache
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
PS:使用 root 运行 composer 的话可能会提示
Do not run Composer as root/super user! See https://getcomposer.org/root for details
也就是叫你不要用 root 用户运行,不过不影响正常使用
©著作权归作者所有,转载或内容合作请联系作者