So nutzt du: PHP Formatter
- Paste your PHP code — with or without the opening
<?phptag. - Set line width, indentation and quote style.
- Copy or download the formatted code.
How the formatter works
The code is parsed into a syntax tree by Prettier’s PHP plugin and printed again from scratch, so the output is consistent regardless of how messy the input was — and the formatter never changes what the code does. Syntax errors are reported with the line, so it doubles as a quick PHP syntax check.
Style options
The defaults follow the common PSR-12 conventions: 4-space indentation and braces for classes and functions on their own line. Line width controls when long arrays and argument lists wrap onto multiple lines. Mixed PHP and HTML templates are supported.
Keep formatting automatic
For whole projects, use the same rules in your editor or CI with Prettier and @prettier/plugin-php, or with PHP-CS-Fixer for PSR-12. Formatting on save keeps diffs focused on real changes.
Private by design
Formatting runs entirely in your browser — your code is never uploaded, so it’s safe for proprietary projects.
Auch gesucht als: php beautifier, format php code, php code formatter online, beautify php, php pretty print, psr-12 formatter.
Passende Tools zu: PHP Formatter
- JavaScript Formatter — Unminify and pretty-print JavaScript, JSON or JSX with your preferred indentation and brace style — or strip whitespace and comments with a verified minifier.
- HTML Formatter — Paste minified or messy markup and get clean, consistently indented HTML — including embedded <style> and <script> blocks.
- SQL Formatter — Paste a query — or a whole migration — and get readable SQL with one clause per line, aligned joins and consistent keyword case, using the grammar of your database.
- JSON Formatierer — Füge JSON ein, um es zu formatieren, zu minifizieren oder zu prüfen.