livewire/blaze
Blaze speeds up Laravel Blade anonymous components by compiling templates into optimized PHP functions. Drop-in replacement with no code changes. Optional memoization and folding for extra gains. Enable via @blaze directive or optimize directories.
@blaze directives or Blaze::optimize(), allowing incremental adoption.@aware require both parent/child components to use Blaze.view:clear command and composer autoloading, minimizing deployment friction.auth(), now(), or database queries). Requires manual validation of folded components.$component variable) require workarounds or exclusion from optimization.AppServiceProvider) or selectively (via @blaze directives)?auth(), request(), session()) that must exclude folding?@slot('header')) be handled?@blaze directives./resources/views/components/ui).compile: false to exclude high-risk subdirectories (e.g., legacy or dynamic-heavy components).@if, @foreach), and components but excludes class-based components and view composers.php artisan view:clear to purge cached views.composer.json and update dependencies.Blaze::optimize()->disabled()) and enable via feature flag.view:clear, adding ~5-10s to deployments for large apps. Mitigate with CI caching or parallel compilation.--debug mode to inspect compiled output.php artisan blaze:clear-memo if available).$__env->shared() for View::share() data).@auth in folded components). Log these centrally.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Folded component uses global state | Silent bugs (e.g., wrong auth state) | Exclude from folding; use @blaze(compile: true) |
| Memoization cache staleness | Stale UI (e.g., outdated icons) | Add cache invalidation logic or disable memoization |
| Blade directive unsupported | Component breaks | Fall back to standard Blade rendering |
| Deployment with uncleared cache | Stale compiled views | Automate view:clear in CI/CD |
| Livewire/Blade boundary issues | @aware data not propagating |
Ensure parent/child both use Blaze |
@blaze directives).php artisan blaze:dump if available).How can I help you explore Laravel packages today?