PHP Formatter
Format pure PHP locally with adjustable indentation and line-and-column syntax diagnostics.
php-formatterLOCAL WORKSPACE
Enabling local controls…
Formatted PHP
Paste source, choose a local file or load the sample to begin.
How to use this tool
Paste a PHP file starting with <?php or open a UTF-8 file. Select two spaces, four spaces or tabs, then format, copy or download the PHP source.
When not to use it
Targets PHP 8.4 syntax with a 128 KiB input and a 512 KiB result limit. Strings, heredocs and nowdocs retain their original text. Mixed PHP/HTML and __halt_compiler payloads are unsupported. Formatting changes source line numbers.