- Clone
kirschbaum-development/php-cs
cd kirschbaum-development/php-cs
composer install
- Set the correct php cs fixer binary in:
- Language & Frameworks -> PHP -> Quality tools
- Place the KDG custom .php_cs configuration file in your home directory
- Within phpstorm, go to:
- Settings -> Editor -> Inspections -> PHP -> Quality tools
- Make sure PHP CS Fixer validation is checked
- In the right hand pane, after selecting this option, click the browse (
...
) button and select the .php_cs file previously saved in your home directory - Ensure PHP Code Sniffer validation is also set to this Coding Standard in its right pane
- Click Apply and OK
- In PHPStorm, create a file watcher (under "Preferences->Tools")
- Uncheck all of the "Advanced Options"
- Edit the following settings:
Name: PHP Style fixer
File type: PHP
Scope: Current File
Path: /{your-global-composer-directory}/vendor/friendsofphp/php-cs-fixer/php-cs-fixer
Arguments: fix $FileDir$/$FileName$ --verbose --config={path-to-your-root-php-cs-dir}/php-cs/.php_cs
- Install PHP CS Fixer extension
- Configure Extension, in
Settings as JSON
"vscode-php-cs-fixer.config": "/{path_to_repository}/.php_cs", "vscode-php-cs-fixer.toolPath": "/{path_to_repository}/vendor/bin/php-cs-fixer", "[php]": { "editor.defaultFormatter": "fterrag.vscode-php-cs-fixer" },
- Find
PHP CS Fixer
using Package Control: Install Package (cmd-shift-p) - Under Preferences -> Package Settings -> PHP CS Fixer -> Settings - User, configure the extension using the following JSON
{ "config": "/path/to/kirschbaum-development/php-cs/.php_cs", "on_save": true, }