Skip to content
| Marketplace
Sign in
Visual Studio Code>Linters>CK's PHP-CS-FixerNew to Visual Studio Code? Get it now.
CK's PHP-CS-Fixer

CK's PHP-CS-Fixer

chenkai2

|
2 installs
| (0) | Free
Integrates PHP-CS-Fixer into Visual Studio Code.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

PHP-CS-Fixer

Integrates PHP-CS-Fixer into Visual Studio Code.

Yet another PHP-CS-Fixer extension?

I tested many other extensions but they did not work for me or are outdated, still using the first version of php-cs-fixer. So i decided to make my own that fit my needs. Very minmal, nothing special just what i like.

Preview

Just by saving your file PHP-CS-Fixer takes care of the code formatting for you.

preview

Requirement

  • php-cs-fixer

For more information please visit: https://cs.symfony.com/

Configuration

  • php-cs-fixer.executable: Path to php-cs-fixer executable.
  • php-cs-fixer.configFile: Path to php-cs-fixer config.
  • php-cs-fixer.pathMode: Set "--path-mode" parameter.
  • php-cs-fixer.onSave: Execute command on save.
  • php-cs-fixer.allowRisky: Allow risky rules.

NOTE: You may need to reload to Visual Studio Code when changing any configuration to take effect.

Error Handling

If an error occurs you can check the Developer Tools Console to get more information.

New features (since recent update)

  • Format unsaved/new PHP documents: you can now run the "Format Document" command on untitled or unsaved PHP editors. The extension writes the buffer to a temporary file, runs php-cs-fixer, and applies the formatted result back into the editor.
  • Concurrency safety: repeated or overlapping format requests for the same editor are serialized — a small lock prevents race conditions.

Notes & Troubleshooting

  • php-cs-fixer operates on filesystem paths. If you use a php-cs-fixer phar that requires php via an env shebang, set php-cs-fixer.executable to include your php binary, for example: php /path/to/php-cs-fixer.
  • GUI instances of VS Code may not inherit your shell PATH. To ensure the extension can find php and php-cs-fixer, start VS Code from your shell with code . or set the full path in php-cs-fixer.executable.
  • Temporary files are created in the system temp directory and removed after formatting. If the process is interrupted, temp files may occasionally remain — they are safe to delete.

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft