A modern code formatter for Laravel, written in Go.
Formats PHP, Blade, and Livewire 4 with Tailwind class sorting. No Node. No Prettier plugin. Just PHP 8.3+.
What it formats
PHP
*.phpSorts imports, splits grouped ones, and drops a trailing ?>.
Blade
*.blade.phpEchoes, directives, and @php blocks go through the PHP formatter.
Livewire 4
⚡*.blade.phpSingle-file pages and components, markup and class together.
HTML
*.htmlTailwind classes are sorted, and Alpine expressions get consistent spacing.
CSS
*.cssThe @theme block also feeds Tailwind class sorting.
Alpine.js
x-data@*Expressions in x-data, x-on, and @ attributes get consistent spacing.
Markdown
*.mdLine wrapping follows markdown.proseWrap.
JSON
*.json*.jsoncIndented 2 spaces, or 4 in composer.json, unless indentWidth is set.
YAML
*.yml*.yamlAlways indented with spaces.
XML
*.xmlA trailing .dist is ignored, so phpunit.xml.dist formats as XML.
Other files are skipped. Full list →
Features
Reads your config
Settings from your Pint, PHP-CS-Fixer, Mago, EditorConfig, and Prettier files are adopted, so there is nothing to restate. Run init when you want a file of your own.
Blade-aware sorting
In bg-{{ $color }}-500, bg- is only a class once Blade fills the hole. Laravel Fmt pins it and sorts around it.
Reads your theme
The @theme block in your stylesheet is loaded before anything is sorted, so bg-brand lands with the built-in colors instead of first.
Verified rewrites
Alpine attributes get canonical spacing. The result is read back token by token, and your original is kept if anything moved.
Language Server
laravel-fmt lsp speaks LSP over stdio for format on save and format selection. Editors that only pipe a buffer use --stdin-filepath.
Parallel, in order
Every core takes a share of the files. Results come back in the order you passed them, so --check prints the same lines every run.