Laravel Pint v1.30.0 adds native Blade template formatting via the Pint/laravel_blade rule, using Prettier under the hood.
Laravel Pint can format your .blade.php views alongside PHP files, keeping template indentation and directive styling consistent across your team.
1. Format via CLI
Format Blade files on demand with the --blade flag:
./vendor/bin/pint --blade
2. Enable Permanently in pint.json
To make Blade formatting the default whenever pint runs (including in CI pipelines), enable the rule in pint.json:
{
"rules": {
"Pint/laravel_blade": true
}
}
Requirements & Mechanics
- Prettier Engine: Pint invokes Prettier under the hood. Node.js must be available on the machine.
- Auto-Installation: Pint auto-detects your package manager (
npm,pnpm,yarn,bun) to install necessary Prettier dependencies when first run. - Zero Config Arguments: Opinionated defaults format loops, components, and directives consistently without configuration arguments.
Related Tips
View all tips →Share Global Template Data Across All Views with View::share()
Use View::share() in AppServiceProvider to make global site settings, user preferences, and theme configurations available across all Blade views automatically.
Render Blade Partials Conditionally with @includeIf, @includeWhen, and @includeFirst
Use includeIf, includeWhen, and includeFirst to cleanly handle optional partials, condition-based views, and fallback templates in Blade.