php开发扩展-可选
2025年5月18日大约 1 分钟
php开发扩展-可选
PHP Server
PHP Symbols
PHP-SYMBOLS是Visual Studio代码插件。基于php-parser
https://marketplace.visualstudio.com/items?itemName=linyang95.php-symbols
phpcs
https://github.com/junstyle/vscode-php-cs-fixer


然后将这个文件移动到php目录下
例如:
D:\\phpstudy_pro\\Extensions\\php\\php7.3.4nts\\php-cs-fixer-v3.phar
全局安装
composer global require squizlabs/php_codesniffer
php cs fixer(未知)
PHP Debug
Format HTML in PHP
PHP Formatter
在使用Visual Studio代码作为扩展安装之后,该扩展将自动格式化您的PHP代码,按照PSR-0、PSR-1、PSR-2或Symfony样式约定。

需要下载
php-cs-fixer-v3.phar
然后添加到环境变量,再进行配置
配置信息如下:
"phpformatter.logging":true,
//不使用composer方式
"phpformatter.composer":false,
//添加自定义参数,默认的参数level已经在新版本中移出所以会导致运行出错
//RULES=[@PSR1,@PSR2,@Symfony]
//source:https://github.com/FriendsOfPHP/PHP-CS-Fixer#usage
"phpformatter.arguments":["--rules=@Symfony"],
// Should point to php-cs-fixer.phar file, if you have installed this manually (without Composer). Should include .phar extension.
// php-cs-fixer.phar路径,使用composer方式时可以不填
"phpformatter.pharPath":"d:/wamp/bin/php/php5.5.12/php-cs-fixer.phar",
// If the pharPath is set, and you are not using Composer, and you haven't added PHP to your PATH, this should point to the php.exe file.
// php路径,使用composer方式时可以不填
"phpformatter.phpPath":"d:/wamp/bin/php/php5.5.12/php.exe"
然后键盘快捷键设置
搜索
phpformatter.fix

