PHP菜鸟博客_共同学习分享PHP技术心得【PHP爱好者】
Vscode安装格式php代码插件之PHP Formatter
2021-8-1 菜鸟站长


1.下载php-cs-fixer.phar到任意目录,尽量放到php目录下)



https://github.com/FriendsOfPHP/PHP-CS-Fixer#installation  



2.安装PHP Formatter 插件并进行自定义设置(php路径、php-cs-fixer.phar路径,Rules等)



1.jpg2.jpg3.jpg



配置信息如下:




{


    //打印日志信息,用于调试


    "phpformatter.logging"true,


    //不使用composer方式


    "phpformatter.composer"false,


    //添加自定义参数,默认的参数level已经在新版本中移出所以会导致运行出错


    //RULES=[@PSR1,@PSR2,@Symfony]


    //source:https://github.com/FriendsOfPHP/PHP-CS-Fixer#usage


    "phpformatter.arguments": [


        "--rules=@PSR2"


    ],


    // 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:/phpstudy_pro/Extensions/php/php7.3.4nts/php-cs-fixer-v2.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:/phpstudy_pro/Extensions/php/php7.3.4nts/php.exe",


    "phpformatter.additionalExtensions": [


    


        


    ]


}





发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容