composer global require friendsofphp/php-cs-fixer
after successfully installation of PHP-CS-FIXER
now install PHP-CS-FIXER VSCODE Extension
in VSCODE User Settings
press Ctrl+, to get VSCODE User Settings
"php-cs-fixer.executablePath": "php-cs-fixer.bat",
"php-cs-fixer.executablePathWindows": "php-cs-fixer.bat",
"php-cs-fixer.onsave": true,
//If you want to create a custom config for php-cs-fixer
//create a .php_cs file in this C:\Users\username\.vscode directory
"php-cs-fixer.config": "C:\\Users\\username\\.vscode\\.php_cs",
That's all! Hope this will help you!
I usually use Local by Flywheel on Windows, and I did not install PHP locally.
In that case, it seems that you need to install PHP separately.
The first step is to go to
https://www.php.net/downloads
from the "Windows downlaods" link at to install PHP in C:\php.
Next, download php-cs-fixer-v3.phar from the following link and place it in ~/.vscode/.
https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/installation.rst
Finally, add the following lines to settings.json and it works fine.