- How do I install Livewire Blaze in my Laravel project?
- Run `composer require livewire/blaze:^1.0` to install Blaze. No additional setup is needed for basic usage, though Flux UI users get automatic compatibility. Clear compiled views afterward with `php artisan view:clear`.
- Can Blaze replace all my Blade components, or only anonymous ones?
- Blaze is designed as a drop-in replacement for **anonymous Blade components** (e.g., `@component('button')`). It won’t work with named components or custom classes. Test thoroughly, especially for dynamic or nested includes.
- What Laravel versions does Blaze support?
- Blaze is compatible with Laravel 10.x and 11.x. Check the [GitHub repo](https://github.com/livewire/blaze) for the latest version requirements. It relies on Laravel’s Blade engine, so ensure your project meets Blade’s minimum PHP 8.1+ requirement.
- How do I enable Blaze for specific components vs. entire directories?
- Use `@blaze` at the top of individual anonymous components for granular control. For bulk optimization, call `Blaze::optimize()->in(resource_path('views/components'))` in your `AppServiceProvider::boot()`. Start with directories to minimize risk.
- Will Blaze break Livewire components or reactive properties?
- Blaze works seamlessly with Livewire’s anonymous components (e.g., `{{ $widget }}`), but custom Livewire components with public properties may need testing. Reactive features like `@entangle` or `@on` should remain unaffected if used within supported Blade directives.
- What are the risks of using memoization or folding strategies?
- Memoization caches repeated renders, which is ideal for static or infrequently updated content but risks stale data if not invalidated properly. Folding pre-renders to HTML, improving speed but eliminating dynamic logic. Test these in staging first, especially for user-specific content.
- How do I monitor Blaze’s performance impact?
- Use Laravel Debugbar to compare rendering times before/after enabling Blaze. Log component-specific metrics with `Blaze::track()` or instrument your `AppServiceProvider` to measure optimization effectiveness per directory.
- Does Blaze work with third-party Blade directives or custom packages?
- Blaze supports core Blade directives (`@if`, `@foreach`, `@stack`) but may not recognize custom directives or packages that modify Blade’s rendering pipeline. Test thoroughly, especially if you rely on dynamic `@include` or complex inheritance.
- Can I use Blaze in production without additional configuration?
- Yes, but enable it incrementally. Start with non-critical components (e.g., footers) and monitor for regressions. For memoization/folding, implement cache versioning (e.g., checksum-based paths) to avoid stale content during deployments.
- What alternatives exist for optimizing Blade rendering in Laravel?
- Alternatives include caching entire views with `view()->share()` or using Laravel’s built-in `@once` directive for static content. For dynamic UIs, consider Livewire’s built-in reactivity or frontend frameworks like Alpine.js. Blaze uniquely targets anonymous components with near-zero refactoring.