Core prettier does not support PHP1, and thus neither does the plugin for VSCode/VSCodium. Luckily the designers of prettier seems to have thought of this and implemented a plugin system2.

According to the prettier-vscode repo, all you need to do to use a plugin is to add it and prettier to your package.json3

So for php support your package.json would need to contain:

{
  "devDependencies": {
    "@prettier/plugin-php": "0.14.3",
    "prettier": "2.0.5"
  }
}
Answer from fredrik on Stack Overflow
🌐
GitHub
github.com › prettier › plugin-php
GitHub - prettier/plugin-php: Prettier PHP Plugin · GitHub
Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.
Starred by 1.8K users
Forked by 138 users
Languages   PHP 67.1% | JavaScript 32.9%
Discussions

Is there a way to prettify PHP code using VS Code?
One option is the prettier-php plugin. If you have the Prettier extension and install the prettier-php plugin package in the project, the Prettier extension will use it. https://github.com/prettier/prettier-php More on reddit.com
🌐 r/vscode
4
3
September 11, 2021
How to install Prettier PHP Plugin in Visual Studio Code
Hello, I am using Visual Studio Code for editing .php files. How can I set up Prettier plugin to format php in vs code. I tried to follow README.md but, I am not able to activate the code formattin... More on github.com
🌐 github.com
21
May 6, 2021
I don't like prettier

Nobody loves what prettier does to their syntax

Everyone loves what prettier does to their coworkers' syntax

More on reddit.com
🌐 r/javascript
258
442
January 31, 2017
prettier-standard - format with prettier with standard.js rules
Working on a large react codebase which uses Flow and class property syntax along with "standard" makes me realise just how stupid the semicolon-less position is, it is straight up laying traps for yourself and others. edit: My objection: - the failure mode for using semicolons is either your code doesn't compile at all because you put one in the wrong place, or you add one too many and the engine doesn't care. The failure mode for omitting semicolons is your code still compiles, it just does something completely different to what you expected. I prefer fail fast. More on reddit.com
🌐 r/javascript
33
17
April 3, 2016
🌐
Prettier
prettier.io › blog › 2018 › 04 › 09 › plugin-php-0.1.html
Prettier for PHP 0.1: First alpha release 🎉 · Prettier
April 9, 2018 - After more than 200 merged pull requests since mid December 2017, we're happy to announce the first alpha release of Prettier for PHP. In this blog post, we'd like to give a short overview of how the plugin works, its philosophy, and what to expect in the future.
🌐
JetBrains
jetbrains.com › help › phpstorm › prettier.html
Prettier | PhpStorm Documentation
November 24, 2025 - Open the Settings dialog (Ctrl+Alt+S) , go to Languages & Frameworks | JavaScript | Prettier, and select Manual Prettier configuration. From the Prettier package list, select the prettier installation to use.
🌐
Phpqa
phpqa.io › projects › prettier-php-plugin.html
Prettier PHP plugin | PHP Quality Assurance
Prettier PHP plugin adds support for the PHP language to Prettier, an opinionated code formatter.
🌐
Loilo
loilo.github.io › prettier-php-playground
Prettier PHP Playground
A playground for the experimental Prettier PHP plugin
Find elsewhere
🌐
Made With Love
madewithlove.com › blog › using-prettier-in-php
Using Prettier in PHP - madewithlove
June 6, 2024 - This is a key difference with the formatting PHPStorm or PCS would give you because they follow very consistent rules: how to break down arguments, methods, classes, et al depending on their width, etc. Prettier doesn’t do that when it formats the code; it barely even knows that it is formatting PHP code because it purely translates the input into an abstract tree and formats it based on how readable it expects the output to be.
🌐
Prettier
prettier.io
Prettier · Opinionated Code Formatter · Prettier
Elm (via elm-format) Java · PHP · Ruby · Rust · TOML · XML · And more... prettier-js prettier.el Apheleia · espresso-prettier · Prettier Prettier⁺ · JsPrettier · vim-prettier neoformat ALE coc-prettier · JavaScriptPrettier · prettier-vscode · Built-in support ·
🌐
npm
npmjs.com › package › @prettier › plugin-php
prettier/plugin-php
July 16, 2025 - Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.
      » npm install @prettier/plugin-php
    
Published   Jul 16, 2025
Version   0.24.0
Author   Lucas Azzola
🌐
DEV Community
dev.to › ngobrolinit › prettier-for-php-file-formats-in-vscode-104o
Prettier for PHP File Formats in VSCode - DEV Community
March 18, 2024 - The solution is to use the settings.json configuration file in VSCode to set the PHP language using PHP Intelephense. Now go to settings and change Default Formatter to Prettier. Why Prettier?
🌐
GitHub
github.com › prettier › plugin-php › issues › 1721
How to install Prettier PHP Plugin in Visual Studio Code · Issue #1721 · prettier/plugin-php
May 6, 2021 - Hello, I am using Visual Studio Code for editing .php files. How can I set up Prettier plugin to format php in vs code. I tried to follow README.md but, I am not able to activate the code formattin...
Author   alexbalak21
🌐
Bordermedia
bordermedia.org › blog › using-prettier-format-php-in-vscode
Using Prettier to format PHP code in VS Code
June 19, 2025 - By default, Prettier supports languages such as JavaScript, TypeScript, HTML, Vue, CSS, SCSS, JSON, Markdown, and many others. However, PHP is not included in the core supported languages.
🌐
SourceForge
sourceforge.net › projects › prettier-php-plugin.mirror
Prettier PHP Plugin download | SourceForge.net
July 16, 2025 - This plugin adds support for the PHP language to Prettier. We're considering the plugin to be stable when pure PHP files are formatted. Formatting of files that contain mixed PHP and HTML is still considered unstable.
🌐
Codethepixel
codethepixel.com › articles › Formatting-PHP-in-VSCode-Using-Prettier-and-PHP-Intelephense
CTP: Formatting PHP in VSCode Using Prettier and PHP Intelephense
June 15, 2025 - Among these, the Prettier extension ... comes to formatting PHP files, many users encounter challenges, as Prettier does not natively support PHP formatting....
🌐
Packagist
packagist.org › packages › mallardduck › prettier-php-runner
mallardduck/prettier-php-runner - Packagist
\MallardDuck\PrettierPhp\PrettierHtml::format( html: '<html><body><div><h1>Heading</h1></div></body></html>' ); ... In your project, you should have the JavaScript package prettier installed. You can install it via npm... ... Make sure you have installed Node 10 or higher. Here's an example where we are going to highlight some PHP code.
🌐
GitHub
github.com › lots0logs › prettier-plugin-php-wp
GitHub - lots0logs/prettier-plugin-php-wp: Prettier PHP Plugin That Enforces WordPress Coding Standards · GitHub
Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.
Author   lots0logs
🌐
npm
npmjs.com › package › @prettier › plugin-php › v › 0.10.2
Prettier PHP Plugin
February 18, 2019 - Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.
      » npm install @prettier/plugin-php
    
Published   Jul 16, 2025
Version   0.10.2
Author   Lucas Azzola