PHP Formatter in VS Code

PHP CS Fixer Installation

Go to extension menu, searching for PHP CS Fixer and install it.

PHP CS Fixer for Visual Studio Code

PHP CS Fixer Configuration

After installed, go to setting and place following snippet below php-cs-fixer.executablePath

"php-cs-fixer.executablePath": "${extensionPath}/php-cs-fixer.phar",
"": {
    "editor.defaultFormatter": "junstyle.php-cs-fixer",
    "editor.formatOnSave": true
"php-cs-fixer.rules": "@PSR2",
"php-cs-fixer.formatHtml": true,
PHP CS Fixer Configuation in Setting
Right click to format PHP code

And happy coding!

Leave a Reply