Skip to main content
Z

PHP Formatter — PSR-12 Beautifier for PHP Source Code

Reformat PHP source in your browser. PSR-12-friendly defaults, brace-style toggle, opener normalization.

Miễn phí Không cần đăng ký Chạy trên trình duyệt Tôn trọng riêng tư Updated

Cách dùng

  1. 1 Paste PHP source.
  2. 2 Pick brace style and indent size.
  3. 3 Toggle whether to normalize short opening tags.
  4. 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.

Tóm tắt

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

Build, share, and grow on Zerethon Social

Free signup. Earn points, collect achievements, and connect with creators worldwide.

Try Zerethon free