PHP Formatter
Beautify, format, validate, and minify PHP scripts with PSR-12 compliance, PHP 8.x features (attributes, enums, match expressions, constructor promotion), and safe sandboxed console execution preview.
Input PHP Code
0 charsPSR-12 & PHP 8.x Formatting Standards & Developer Specification Reference
Modern PHP 8.x Features
Full support for PHP 8.x attributes (#[Route('/api')]), Readonly classes, Enums (enum Status: string), Match expressions, and Constructor Property Promotion.
Security Safeguards
Treats code strictly as text data for formatting. NEVER executes uploaded PHP code on the server host, protecting server environment variables and files.
PSR-12 Indentation Rules
Formated according to PSR-12 coding style guidelines with 4 space indents, opening brace placement, visibility declarations, and return type declaration formatting.
Heredoc & Nowdoc Preservation
Multiline Heredoc (<<<TEXT) and Nowdoc (<<<'TEXT') string bodies are preserved verbatim without running code formatting inside string literals.