php多版本环境使用composer

1:下载composer.phar

官网有直接下载的链接,可以php脚本下载, 也可以直接复制下载链接, 页面下很多版本 :  https://getcomposer.org/download/

2:composer.phar 复制到项目根目录

3:找到php安装路径

D:\\kiwiwork\\Visual-NMP-x64\\Bin\\PHP\\php-7.1.33-nts-x64\\php  -v

安装(下不下来)
D:\\kiwiwork\\Visual-NMP-x64\\Bin\\PHP\\php-7.1.33-nts-x64\\php -r “copy(‘https://getcomposer.org/installer’, ‘composer-setup.php’);”
D:\\kiwiwork\\Visual-NMP-x64\\Bin\\PHP\\php-7.1.33-nts-x64\\php -r “if (hash_file(‘sha384’, ‘composer-setup.php’) === ‘756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3’) { echo ‘Installer verified’; } else { echo ‘Installer corrupt’; unlink(‘composer-setup.php’); } echo PHP_EOL;”
D:\\kiwiwork\\Visual-NMP-x64\\Bin\\PHP\\php-7.1.33-nts-x64\\php composer-setup.php
D:\\kiwiwork\\Visual-NMP-x64\\Bin\\PHP\\php-7.1.33-nts-x64\\php -r “unlink(‘composer-setup.php’);”

 

Bug1: 下载 composer-setup.php报错, 最后还是直接通过链接下载的,  https://getcomposer.org/download/2.0.7/composer.phar

Warning: copy(): Unable to find the wrapper “https” – did you forget to enable it when you configured PHP? in Command line code on line 1
解决1
开启php_openssl.dll

命令
D:\\kiwiwork\\Visual-NMP-x64\\Bin\\PHP\\php-7.1.33-nts-x64\\php composer.phar require hisamu/php-xbase

BUG2
The “topthink/think-installer” plugin was skipped because it requires a Plugin API version (“^1.0”) that does not match your Composer installation (“2.0.0”). You may need to run composer update with the “–no-plugins” option.
解决2
下载的composer.phar, 用的2.x的, 换成 1.x版本的(之前bobo下载过的)

BUG3
phpoffice/phpspreadsheet 1.9.0 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
解决3
开启 extension=php_fileinfo.dll

 

注:使用composer.phar

php composer.phar require easy-task/easy-task