Skip to content
Devtoolry

PHP Formatter

Beautify PHP code following PSR-style formatting with the Prettier PHP plugin.

About the PHP Formatter

The PHP Formatter uses the Prettier PHP plugin to produce consistent, PSR-style code: braces, spacing and line breaks are normalised so diffs only show real changes.

Everything runs in your browser, so your input is never uploaded to a server.

How to use the PHP Formatter

  1. Paste PHP code (with or without the opening <?php tag) or open a file.
  2. Choose indentation.
  3. Copy or download the formatted code.

Frequently asked questions

Is the output PSR-12 compliant?

It follows PSR-style conventions for layout. Rules that need semantic changes (such as naming) are not applied.

Does it run my PHP code?

No. The code is only parsed and formatted in your browser; use the PHP Compiler to run it.