PrettyPHP for Visual Studio Code
The opinionated formatter for modern, expressive PHP
This extension integrates the latest release of PrettyPHP, a code formatter inspired by Black, with Visual Studio Code.
Like Black, PrettyPHP runs with sensible defaults and doesn't need to be configured. It's also deterministic (with some pragmatic exceptions), so no matter how the input is formatted, it produces the same output.
PrettyPHP requires PHP 7.4, 8.0, 8.1, or 8.2 with a CLI runtime and the
How is PrettyPHP different to other formatters?
It's a formatter, not a fixer
(Some pragmatic exceptions are made.)
It's optionally compatible with coding standards
PrettyPHP has partial support for PSR-12. An upcoming release will offer full support.
Why are there so many options?
Because PrettyPHP is in initial development, PHP formatting is complicated, and testing is easier when settings can be changed at runtime.
Over time, PrettyPHP will become more opinionated and have fewer options, so reliance on formatting options is discouraged.