Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

flynnmj's avatar

VSCode and php-cs-fixer config error/fix

Using VSCode as my editor with the php-cs-fixer extension installed and just used "@PhpCsFixer" as my rule set. Things worked as expected.

Trying to get fancy and use a config file from Laravel Shift for php-cs-fixer. Added ".php-cs-fixer-laravel.php" to the list of config files to look for and removed "@PhpCsFixer" as my rule set. Code formatting/fixing not working as expected. Config file is working fine when running php-cs-fixer from my shell.

The code for this repo/workspace is not at the root but under ./src. After reading the fine print, I realized that the "php-cs-fixer.config" setting needed to have path to the config file since it was not at the root. Fine print say full path, but I was able to configure it with a relative path ("./src/.php-cs-fixer-laravel.php"). Things started to work as expected again.

Hope this points you in right direction to get php-cs-fixer working inside VSCode.

0 likes
0 replies

Please or to participate in this conversation.