Prettier formats JavaScript beautifully. It also handles TypeScript, CSS, and HTML reasonably well. But the moment you work on a Laravel project — which means PHP, Blade templates, and vanilla JS all in one codebase — you run into friction.

Prettier doesn't format PHP natively. There's a community plugin (@prettier/plugin-php) but it can produce unexpected results with certain Blade-embedded PHP constructs. For Blade templates specifically, there's a separate extension called shufo/blade-formatter. If you're using SCSS, you might have a third extension or a Prettier plugin for that too.

By the time you've configured three formatters to not conflict with each other, you've spent 30 minutes on tooling instead of code.

The specific gap I was filling

I work primarily with:

  • Laravel Blade (PHP + HTML + Blade directives mixed)
  • Vanilla HTML
  • JavaScript / TypeScript
  • SCSS

No single formatter I tried handled all four consistently. The indent rules varied. Blade directive indentation was completely ignored by Prettier. And Prettier's HTML formatting (wrapping attributes across multiple lines) wasn't always what I wanted for template files.

The decision to build

The core formatter I needed wasn't that complex: a line-by-line parser that tracks indent level, applies language-specific rules for opening and closing constructs, handles comments, and outputs re-indented code. This is a well-understood algorithm — the complexity is in the edge cases.

I decided to build it as a proper VS Code extension rather than a script, so it integrates with Format on Save and Format Document like any other formatter. The result is mkhCodeFormatter: one extension, one consistent formatting behavior, across the entire Laravel full-stack.

---

Mustafa Kamal Hossain

Mustafa Kamal Hossain

Founder & Principal Engineer at Manfi. Passionate about Laravel, SaaS architecture, and high-performance engineering.