What it formats
The languages and files Laravel Fmt formats.
| Language | Files |
|---|---|
| PHP | .php |
| Blade | .blade.php |
| Livewire 4 | ⚡*.blade.php |
| HTML | .html |
| CSS | .css |
| Markdown | .md |
| JSON | .json, .jsonc |
| YAML | .yml, .yaml |
| XML | .xml |
Other files are skipped. Tailwind classes are sorted.
Livewire 4
A .blade.php file whose opening <?php block defines a new class is a Livewire 4 single-file
component.
Alpine.js
Expressions in x-data, x-init, x-show, x-text, x-html, x-model, x-modelable,
x-effect, x-if, x-id, x-for, x-on:*, x-bind:*, and @* get consistent spacing. The :
shorthand is left alone. ! follows php.notOperatorSpace.
JSON in <script>
A <script> with type application/ld+json, application/json, importmap, or
speculationrules formats as JSON.
Markdown code blocks
PHP, Blade, HTML, CSS, JSON, YAML, and XML code blocks are formatted. A block tagged with a full
extension such as blade.php formats like a file with that extension. PHP snippets don’t need <?php. A block that
doesn’t parse is kept as written.
.dist files
A trailing .dist is ignored, so phpunit.xml.dist formats as XML.
What it does not do
Laravel Fmt only formats. For linting and fixing code, use tools like Pint or PHPStan.