A Visual Studio Code extension that formats Laravel Blade files with fixed style rules. It can also share formatting behavior with the separate blade-formatter CLI.
Overview
Laravel Blade formatter is a Visual Studio Code extension that applies opinionated formatting to Blade template files. It targets developers working in Laravel projects who want consistent indentation, spacing around template markers, and layout options without leaving the editor.
The formatter indents markup inside Blade directives, adds spacing around template markers, and can format PHP inside directives with PSR-2-style rules. It supports PHP 8 syntax features such as the nullsafe operator and named arguments, and can sort Tailwind CSS classes according to your tailwind.config.js.
Many behaviors are controlled through extension settings or project files. You can store defaults in .bladeformatterrc.json or .bladeformatterrc at the project root, exclude paths with a .bladeignore file using gitignore syntax, and disable formatting for whole files, regions, or single lines via Blade comments.
The same formatting approach is available programmatically through the blade-formatter package that this extension relies on. Optional telemetry sends usage data to Azure Application Insights unless disabled via editor telemetry settings.
Key features
- Indent markup inside Blade directives
- Spacing around Blade template markers
- PHP 8 syntax inside directives
- PSR-2 formatting inside directives
- Optional Tailwind class sorting
- Project .bladeformatterrc configuration
- .bladeignore exclude patterns
- Per-file or per-line format disable comments
Use cases
- Format Laravel Blade views in VS Code
- Enforce consistent Blade layout in teams
- Sort Tailwind classes in templates
- Share formatter settings via project config