Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Blaze Laravel Package

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.

View on GitHub
Deep Wiki
Context7

A tool for optimizing Blade component performance by folding them into parent templates

Frequently asked questions about Blaze
How do I install Livewire/Blaze in my Laravel project?
Run `composer require livewire/blaze:^1.0` to install Blaze. No additional Laravel version requirements beyond standard Blade support. Clear your view cache afterward with `php artisan view:clear`.
Will Blaze work with my existing Livewire or Alpine.js components?
Yes, Blaze integrates seamlessly with Livewire and Alpine.js, especially Flux UI. It optimizes Blade rendering without touching JavaScript logic. Test edge cases like dynamic attributes or event listeners post-installation.
Can I use Blaze with class-based components (e.g., `php artisan make:component`)?
No, Blaze is designed for anonymous Blade components only. Class-based components (stored in `app/View/Components/`) are not supported. Profile your app first to identify anonymous components for optimization.
What’s the difference between `@blaze`, memoization, and folding?
`@blaze` alone compiles components into PHP functions for speed. Memoization caches repeated renders (use for static data like icons). Folding pre-renders to static HTML (best for truly static content). Memoization and folding require extra configuration and testing.
How do I enable Blaze for an entire directory of views?
Add `Blaze::optimize()->in(resource_path('views/path'))` to your `AppServiceProvider::boot()`. Start with a single directory to test compatibility. Run `php artisan view:clear` afterward. Avoid directories with unsupported Blade features like `@stack` or `@inject`.
Will Blaze break my app if I enable it globally?
Blaze maintains near-full Blade feature parity, but some features (e.g., `@stack`, `@section`, `@auth`, `now()`) may fail silently. Test thoroughly in staging first. Use `@blaze` per-component for gradual adoption.
How do I measure Blaze’s performance impact?
Use Laravel Debugbar or Telescope to profile Blade rendering times before/after. For large-scale tests, compare GTmetrix or Lighthouse scores. Blaze typically reduces rendering overhead by 91-97% for anonymous components.
Are there alternatives to Blaze for optimizing Laravel Blade?
For anonymous components, Blaze is the most targeted solution. Alternatives include caching entire views with `Cache::remember()` or using static site generators (e.g., Laravel Vapor + Blade). However, none match Blaze’s granular, drop-in optimization for Blade.
How do I handle cache invalidation when using Blaze?
Always run `php artisan view:clear` after enabling Blaze or updating optimized components. For CI/CD pipelines, automate this step. Memoized or folded components may need manual cache busting if their underlying data changes.
Can I use Blaze with Laravel’s Inertia.js integration?
Yes, Blaze works with Inertia.js since it optimizes Blade rendering on the server. Ensure your Inertia pages use anonymous components (not class-based) for full compatibility. Test page hydration times for improvements.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony