1.下载composer.phar文件
https://install.phpcomposer.com/composer.phar
2.将composer.phar移动到与php.exe程序同一个目录,并创建composer.bat
composer.bat文件添加如下一段内容
@php "%~dp0composer.phar" %
3.为php程序设置为全局
4.在命令终端测试是否安装成功,如下图所示,说明安装成功
D:phpstudy_proWWWswoole> composer -v ______ / ____/___ ____ ___ ____ ____ ________ _____ / / / __ / __ `__ / __ / __ / ___/ _ / ___/ / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ / \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/ /_/ Composer version 2.0-dev
5.为swoole项目安装Swoole/ide-helper插件
在vscode打开swoole项目,在ctrl+~开启终端,执行如下命令
composer require Swoole/ide-helper
6.测试
<?php $server = new SwooleServer('0.0.0.0', 9501);