composer安装

官方网址

https://pkg.xyz/#how-to-install-composer

https://www.phpcomposer.com/

https://install.phpcomposer.com/installer

配置php环境变量


php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');"
php -r "copy('http://install.phpcomposer.com/installer', 'composer-setup.php');"

php composer-setup.php

#安装后删除
php -r "unlink('composer-setup.php');"

查看版本号

php composer.phar -V
Composer version 2.5.8 2023-06-09 17:13:21

php composer.phar --version
Composer version 2.5.8 2023-06-09 17:13:21

可以将 composer.phar 文件复制到任意目录(比如项目根目录下),然后通过 php composer.phar 指令即可使用 Composer 了!

建立composer.bat

@php "%~dp0composer.phar" %*

查看配置

composer --version
Composer version 2.5.8 2023-06-09 17:13:21

提示:不要忘了经常执行 composer selfupdate 以保持 Composer 一直是最新版本哦!

阿里云:

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

华为云:

composer config -g repo.packagist composer https://repo.huaweicloud.com/repository/php/

你可能感兴趣的:(php,composer,开发语言)