PHP Formatter

PHP Formatter beautifies PHP code with consistent indentation, line wrapping, braces, operators, arrays, function calls, classes, attributes, match expressions, and comments. Paste a complete PHP file or a temporary PHP snippet; snippets without an opening <?php tag are handled automatically.

Choose the target PHP version, tabs or spaces, line width, brace style, trailing commas, and quote style. Syntax errors appear in the output editor so the input remains available for correction.

Use the formatter for PHP files and standalone snippets. Mixed PHP and HTML templates may contain framework-specific syntax that requires project-specific formatting rules.