PHP Formatter — PSR-12 Beautifier for PHP Source Code
Reformat PHP source in your browser. PSR-12-friendly defaults, brace-style toggle, opener normalization.
Cách dùng
- 1 Paste PHP source.
- 2 Pick brace style and indent size.
- 3 Toggle whether to normalize short opening tags.
- 4 Copy or download the result.
Vì sao dùng công cụ này
- No client-side PHP parser exists — this is a rule-based reformatter that handles braces and indent reliably.
- PSR-12 friendly defaults: K&R braces, 4-space indent.
- Pure client-side — your code never leaves the browser.
- For an authoritative format, run <code class="rounded bg-slate-100 px-1 text-xs dark:bg-slate-800">vendor/bin/pint</code> or <code class="rounded bg-slate-100 px-1 text-xs dark:bg-slate-800">php-cs-fixer</code> locally.
Câu hỏi thường gặp
Is this PSR-12 compliant?
It produces output close to PSR-12 (K&R braces, 4-space indent) but does not enforce every rule — line wrapping, import order, and method-spacing rules are not applied. For full PSR-12 use Pint or PHP-CS-Fixer.
Will it touch my HTML in templates?
It only reindents lines that contain PHP. Mixed HTML/PHP files may lose indentation inside the HTML sections — use a Blade-aware formatter for templates.
Looking for an HTML formatter?
Yes — see our <a href="/html-formatter" class="underline">HTML Formatter</a>.
PHP Formatter là gì?
A PHP Formatter is a tool that reformats PHP source code in the browser using PSR-12-friendly defaults. It offers a brace-style toggle and tag-opener normalization, reindenting code for consistent layout and readability. Because it runs entirely client-side, the source code stays on the user's device.
PHP Formatter là công cụ lập trình miễn phí của Zerethon Tools. Reformat PHP source in your browser. PSR-12-friendly defaults, brace-style toggle, opener normalization. Chạy hoàn toàn trong trình duyệt — không đăng ký, không tải lên.
- Danh mục
- Lập trình
- Giá
- Miễn phí
- Quyền riêng tư
- Chạy trên trình duyệt
- Đăng ký
- Không cần
Quyền riêng tư
Dữ liệu của bạn không bao giờ rời khỏi trình duyệt trừ khi được nêu rõ. PHP Formatter chạy hoàn toàn phía client — không tải lên máy chủ, không ghi log, không theo dõi dữ liệu bạn nhập.
Công cụ liên quan
JSON Formatter
Format, validate, and minify JSON online. Free, no signup — your data never leaves your browser.
Mở công cụSQL Formatter
Format SQL queries online — beautify MySQL, PostgreSQL, SQLite, SQL Server, Oracle, and BigQuery.
Mở công cụUUID Generator
Generate UUIDs online — v1, v4, v7, and Nil. Bulk generation up to 10,000. Free, no signup.
Mở công cụPassword Generator
Generate strong, cryptographically random passwords. Configurable length and character sets — runs in your browser.
Mở công cụBuild, share, and grow on Zerethon Social
Free signup. Earn points, collect achievements, and connect with creators worldwide.