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

Technical Evaluation

Architecture Fit

Livewire/Blaze is a drop-in optimization for Laravel Blade components, specifically targeting anonymous components (not class-based). It replaces the standard Blade rendering pipeline with pre-compiled PHP functions, eliminating 91-97% of rendering overhead while maintaining near-full feature parity. This aligns well with modern Laravel applications where:

  • Performance-critical UI (e.g., dashboards, admin panels, or high-traffic pages) benefits from reduced rendering latency.
  • Component-heavy architectures (e.g., Flux UI, Livewire, or Alpine.js-driven UIs) can leverage Blaze’s optimizations without refactoring.
  • Static or semi-static content (e.g., icons, cards, modals) can use folding or memoization for extreme performance gains.

Key Fit Criteria:Anonymous Blade components (primary target). ✅ No changes to existing code (drop-in via @blaze directive or directory optimization). ✅ Compatibility with Livewire/Alpine (Flux UI integration). ❌ Not suitable for class-based components (e.g., php artisan make:component). ❌ Limited support for Blade features (e.g., @stack, @section, @inject, @can).


Integration Feasibility

Blaze integrates via two mechanisms:

  1. Per-component opt-in (@blaze directive in Blade files).
  2. Directory-level optimization (via Blaze::optimize() in AppServiceProvider).

Feasibility Assessment:

Integration Path Effort Risk Best For
Opt-in per component Low Minimal (test edge cases) Gradual adoption, A/B testing
Directory optimization Medium Higher (feature parity testing) Large-scale rollouts, performance-critical apps
Folding/Memoization High High (global state, dynamic logic) Static-heavy components (icons, cards)

Compatibility:

  • Works with Livewire/Alpine (Flux UI out-of-the-box).
  • No database or ORM changes (pure Blade optimization).
  • Requires view:clear after enabling (cache invalidation).

Key Risks:

  • False positives in folding: Dynamic logic (e.g., @auth, now()) may break folded components.
  • Slot/attribute limitations: Nested @aware or unsupported Blade features may fail silently.
  • Testing overhead: Performance gains must be validated against edge cases.

Technical Risk

Risk Area Severity Mitigation
Folding breaking dynamic logic High Start with @blaze (no folding), test thoroughly before enabling fold: true.
Memoization stale data Medium Avoid for components with side effects (e.g., tracking clicks).
Blade feature gaps Medium Audit components for unsupported features (e.g., @stack, @inject).
Cache invalidation Low Run php artisan view:clear post-deployment.
Livewire/Alpine conflicts Low Test with Flux UI or Alpine.js integrations.

Critical Questions for TPM:

  1. Which components are performance bottlenecks? (Profile with Blade first.)
  2. Can we tolerate folded components breaking if dynamic logic is used?
  3. How will we test folding/memoization? (Unit tests for edge cases.)
  4. What’s the fallback if Blaze causes regressions? (Feature flags, rollback plan.)
  5. Does our CI/CD pipeline support view:clear? (Automate cache invalidation.)

Integration Approach

Stack Fit

Blaze is optimized for Laravel ecosystems where:

  • Blade components are the primary templating engine.
  • Livewire/Alpine.js is used for interactivity (Flux UI integration).
  • High render counts (e.g., loops, modals, icons) degrade performance.

Best Stack Matches:Laravel + Livewire/Alpine (Flux UI, Tailwind, Inertia.js). ✅ Component-heavy UIs (admin panels, dashboards). ✅ Static-heavy apps (marketing sites, documentation).

Poor Fit:Class-based components (e.g., php artisan make:component). ❌ Heavy server-side logic (Blaze optimizes rendering, not business logic). ❌ Dynamic content with global state (e.g., @auth, now()).


Migration Path

Phase Action Tools/Validation
1. Assessment Profile Blade rendering bottlenecks (e.g., Xdebug, Laravel Debugbar). telescope:record for slow component renders.
2. Pilot Testing Add @blaze to 1-2 high-impact components. A/B test performance (e.g., GTmetrix).
3. Directory Opt-in Enable Blaze::optimize() for non-critical directories. Feature flags for gradual rollout.
4. Advanced Strategies Enable memo: true or fold: true for static components. Unit tests for folded components.
5. Full Rollout Optimize remaining directories, monitor errors. Sentry/New Relic for runtime issues.

Sequencing Recommendations:

  1. Start with @blaze directives (low risk, easy rollback).
  2. Avoid folding initially (highest risk; test with memo: true first).
  3. Exclude dynamic directories (e.g., /views/auth, /views/reports).
  4. Monitor memory usage (folding reduces CPU but may increase compiled view size).

Compatibility

Feature Supported? Notes
Anonymous Blade components ✅ Yes Primary target.
Class-based components ❌ No Use standard Blade rendering.
@props ✅ Yes Works with function compilation.
Slots ✅ Yes Placeholder-based (no folding for unsafe slots).
@aware ⚠️ Partial Both parent/child must use Blaze.
@stack/@section ❌ No Not supported.
@inject ❌ No Use $__env->shared() as workaround.
Livewire/Alpine ✅ Yes Flux UI integration out-of-the-box.
Memoization ✅ Yes Only for components without slots.
Folding ✅ Yes High caution: Global state breaks folding.

Workarounds for Unsupported Features:

  • Replace @inject with $__env->shared('key').
  • Use {{ $__env->yieldContent('section') }} for @section compatibility.
  • Avoid @auth, @guest, or now() in folded components.

Operational Impact

Maintenance

Aspect Impact Mitigation
Compiled views Blaze increases compiled view size (folding embeds HTML). Monitor disk space; optimize with view:clear.
Cache invalidation view:clear required after Blaze changes. Automate in CI/CD (e.g., post-deploy script).
Debugging Folded components are static; runtime errors harder to trace. Log warnings for unsupported features.
Dependency updates Blaze is tied to Laravel/Livewire versions. Pin versions in composer.json.

Maintenance Tasks:

  • Quarterly audit: Check for unsupported Blade features in optimized directories.
  • Performance regression testing: Compare Blade vs. Blaze render times post-updates.
  • Documentation: Track which components use @blaze and their strategies.

Support

Issue Type Likelihood Resolution Path
Folding breaking High Revert to @blaze (no folding), refactor logic.
Memoization stale data Medium Disable memoization; use @blaze only.
Blade feature gaps Medium Workarounds (e.g., $__env->shared()).
Livewire conflicts Low Test with Flux
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.
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
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
ecotone/kafka
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata