配置环境变量、php.ini
配置好path环境变量,php 开发环境准备 php.ini
778 ;extension_dir = "ext" 修改为
778 extension_dir = "ext"
952 ;extension=openssl 修改为
952 extension=openssl
下载 composer-setup.php
php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');"
安装
安装composer 组件 composer.phar
php composer-setup.php
删除
删除安装程序 composer-setup.php
php -r "unlink('composer-setup.php');"
查看php和composer信息
C:\>php --version
PHP 8.3.0 (cli) (built: Nov 21 2023 17:48:00) (NTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.3.0, Copyright (c) Zend Technologies
C:\>composer --version
Composer version 2.6.5 2023-10-06 10:11:52
C:\>
在php目录下也可以使用如下命令
php composer.phar --version
建立composer.bat文件
建立composer.bat文件,内容如下:
@php "%~dp0composer.phar" %*
设置aliyun国内镜像
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
更新版本composer
C:\>composer self-update #更新
C:\>composer -V
Composer version 2.6.5 2023-10-06 10:11:52
C:\>composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
C:\>composer self-update
You are already using the latest available Composer version 2.6.5 (stable channel).
C:\>