From the official doc here: https://github.com/prettier/plugin-php for Visual Studio Code: add php to document selectors in vscode settings (settings.json)

 "prettier.documentSelectors": [
    "**/*.{js,jsx,ts,tsx,vue,html,css,scss,less,json,md,mdx,graphql,yaml,yml,php}"
  ]

and declare the php parser in prettier config file (.prettierrc) https://prettier.io/docs/en/configuration

{
    "parser": "php",
    "plugins": ["@prettier/plugin-php"]
}
Answer from Didier Corbière on Stack Overflow
🌐
GitHub
github.com › prettier › plugin-php
GitHub - prettier/plugin-php: Prettier PHP Plugin · GitHub
For example, if you are using PHP 7.4, but the plugin is set to PHP 8.3, it will produce code that uses features not available in PHP 7.4. A comment // prettier-ignore will exclude the next node in the abstract syntax tree from formatting. ... The official prettier plugin for vscode supports ...
Author   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...
Published   May 06, 2021
🌐
GitHub
github.com › prettier › prettier-vscode › issues › 1059
Not working for PHP · Issue #1059 · prettier/prettier-vscode
August 23, 2019 - Prettier & Prettier Plugin Version: Prettier: 1.19.1, Pretier/plugin-php: 0.11.2, prettier/prettier-vscode: 3.6.0
Published   Nov 15, 2019
🌐
GitHub
github.com › prettier › prettier-vscode › discussions › 3184
Prettier not formatting PHP Code · prettier/prettier-vscode · Discussion #3184
I have PHP v8.2.11 currently installed and set up I installed prettier via the Extensions Tab in VS Code I ran npm install --global prettier @prettier/plugin-php After I ran npm fund as instructed from the terminal I set my formatter as Prettier under my language settings in VS Code.
Author   prettier
🌐
GitHub
github.com › karye › prettier-php-vscode
GitHub - karye/prettier-php-vscode: Visual Studio Code extension for Prettier · GitHub
Visual Studio Code extension for Prettier. Contribute to karye/prettier-php-vscode development by creating an account on GitHub.
Author   karye
🌐
trungpv
trungpv1601.github.io › 2020 › 01 › 04 › Using-Prettier-code-formatter-in-PHP-with-VSCode
Using Prettier code formatter in PHP with VSCode
January 4, 2020 - You need to install @prettier/plugin-php in folder vscode extention: cd ~/.vscode/extensions/esbenp.prettier-vscode-3.18.0
Find elsewhere
🌐
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 - You can just read the Use section on the GitHub page to see how to use the plugin together with Prettier to format the PHP language. In my opinion, this method is quite complicated because it would be easier if the formatting was executed when ...
🌐
GitHub
github.com › svipas › vscode-prettier-plus
GitHub - svipas/vscode-prettier-plus: Prettier (code formatter) for the VS Code.
If you would rather use ESLint, ... This extension supports only official plugins. PHP: install prettier and @prettier/plugin-php locally or globally with npm or Yarn....
Starred by 20 users
Forked by 3 users
Languages   TypeScript 89.9% | JavaScript 8.5% | CSS 1.1%
🌐
Prettier
prettier.io
Prettier · Opinionated Code Formatter · Prettier
GitHub-Flavored Markdown · MDX v1 · GraphQL · GraphQL Schemas · Community Plugins · Apex · 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 ·
🌐
GitHub
github.com › r1pped › prettier-vscode-php
GitHub - r1pped/prettier-vscode-php: Visual Studio Code extension for Prettier with PHP support
Visual Studio Code extension for Prettier with PHP support - r1pped/prettier-vscode-php
Author   r1pped
🌐
GitHub
github.com › karye › prettier-php-vscode › blob › master › README.md
karye/prettier-php-vscode
Visual Studio Code extension for Prettier. Contribute to karye/prettier-php-vscode development by creating an account on GitHub.
Author   karye
🌐
GitHub
github.com › php-dev › prettier-plugin-php
GitHub - php-dev/prettier-plugin-php: Prettier PHP Plugin
After restarting VScode the plugin should work as expected. Sublime Text support is available through Package Control and the JsPrettier plugin. Regarding plugin support in the official plugin vim-prettier see this issue. The linting plugin ALE has built-in support for prettier and its plugins. Just add prettier to your list of fixers. For example: let g:ale_fixers={ \'javascript': ['prettier'], \'json': ['prettier'], \'php...
Author   php-dev
🌐
GitHub
github.com › prettier
Prettier · GitHub
prettier-vscode Public · Visual Studio Code extension for Prettier · TypeScript 5.5k 509 · plugin-php · plugin-php Public · Prettier PHP Plugin · PHP 1.8k 139 · plugin-ruby · plugin-ruby Public · Prettier Ruby Plugin · JavaScript 1.5k 101 · plugin-xml ·
🌐
npm
npmjs.com › package › @prettier › plugin-php
prettier/plugin-php
npm install --save-dev prettier @prettier/plugin-php # or globally (pending https://github.com/prettier/prettier/issues/15141) npm install --global prettier @prettier/plugin-php
      » npm install @prettier/plugin-php
    
Published   Jul 16, 2025
Version   0.24.0
Author   Lucas Azzola
🌐
GitHub
github.com › prettier › plugin-php › releases
Releases · prettier/plugin-php
vscode documentation update (#2194, thanks @WazzaJB!) ... There was an error while loading. Please reload this page. ... There was an error while loading. Please reload this page. ... Many thanks to @fisker for many contributions! ... This adds support for Prettier v3.
Author   prettier
🌐
GitHub
github.com › prettier › prettier-vscode › issues › 2564
Detect global installation of prettier/plugin-php · Issue #2564 · prettier/prettier-vscode
March 7, 2022 - Is your feature request related to a problem? Please describe. The php plugin for prettier (https://github.com/prettier/plugin-php) is supported by prettier-vscode, but only when plugin-php is installed locally via yarn/npm: npm install ...
Published   May 30, 2022
🌐
UNPKG
unpkg.com › @prettier › plugin-php@0.14.0 › README.md
Unpkg
For example: ```php matrix( 1, 0, 0, 0, 1, 0, 0, 0, 1 ); // prettier-ignore matrix( 1, 0, 0, 0, 1, 0, 0, 0, 1 ); ``` will be transformed to ```php matrix(1, 0, 0, 0, 1, 0, 0, 0, 1); // prettier-ignore matrix( 1, 0, 0, 0, 1, 0, 0, 0, 1 ) ``` ## Editor integration ### Atom The official [prettier plugin for atom](https://github.com/prettier/prettier-atom) supports plugins. ### VScode The official [prettier plugin for vscode](https://github.com/prettier/prettier-vscode) supports plugins since Version 1.10.0.