livewire/blaze
Blaze accelerates Laravel anonymous Blade components by compiling templates into optimized PHP functions, cutting 91–97% of rendering overhead with drop-in compatibility. Enable per component via @blaze or optimize directories, with optional memoization and folding.
@if, @foreach) but may require validation for edge cases like dynamic component registration or complex inheritance. Memoization/folding add complexity but enable advanced optimizations (e.g., static HTML for marketing pages).@blaze directive or directory-based optimization requires minimal configuration.{{ $widget }}) dominate. Caveat: Custom Livewire components (with public $properties) may need testing for compatibility.@include: Nested includes may not optimize as expected.@myDirective) might need explicit support.@blaze on non-critical anonymous components (e.g., footers, static modals)./resources/views/components/ or feature-specific folders.config('blaze.enabled')).blade.php checksums).@if, @foreach, @stack, and @component. Limitations:
@include may not optimize nested templates.@once directives could interfere with memoization.{{ $widget }} but may need testing for:
@entangle).spatie/laravel-blade-expressions).livewire/blaze:^1.0).config/app.php providers.@blaze directive on a single component.Blaze::optimizeDirectory().php artisan blaze:clear for cache invalidation.views/Component@1.2.blade.php).Blaze::debug() to revert to standard Blade for troubleshooting.@blaze directive. Advanced features (memoization) require understanding of Laravel’s cache system.Blaze\Exceptions\CompilationException in Sentry/Loggly.memory_get_usage().blaze:compile job).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Template compilation error | Broken UI for affected components | Fallback to standard Blade rendering |
| Memoization cache corruption | Stale content | Cache versioning + TTLs |
| Livewire property binding issues | Component state loss | Test custom Livewire components |
| PHP version incompatibility | Runtime errors | Pin livewire/blaze to compatible version |
| Unhandled Blade directives | Rendering failures | Whitelist supported directives |
@blaze directive usage.How can I help you explore Laravel packages today?