blaze-optimize

Installs and configures Blaze to compile anonymous Blade components into optimized PHP functions.

1|Updated Aug 4, 2026
One-click install
npx skills add https://github.com/LaravelDaily/nativephp-larapackagehunt --skill blaze-optimize-laraveldaily
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: blaze-optimize
Source: https://github.com/LaravelDaily/nativephp-larapackagehunt/tree/main/.agents/skills/blaze-optimize
Command: npx skills add https://github.com/LaravelDaily/nativephp-larapackagehunt --skill blaze-optimize-laraveldaily

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires livewire/blaze, and includes references (resource) components.

What problem does it solve? Rendering large numbers of Blade components in Laravel applications adds runtime overhead. This Skill automates the setup of Livewire Blaze, which compiles anonymous Blade components into optimized PHP functions, and guides safe application of memoization and folding optimizations. ## Core Features & Use Cases - Automated Blaze Setup: Installs livewire/blaze via Composer, scans the codebase for components and custom component paths, and registers compilation in AppServiceProvider. - Compatibility Checking: Greps components for unsupported patterns (class-based components, $component variable, view composers, View::share) and excludes incompatible files from compilation. - Advanced Optimization: Applies trace-based or code-analysis-driven memoization and folding with safe/unsafe prop classification, plus refactors like converting slots to props. - Use Case: A Laravel app renders hundreds of icon and badge components per page. Use this Skill to enable Blaze compilation, then analyze trace data to memoize high-volume components and reduce render time. ## Quick Start Set up Blaze in my Laravel project and optimize my Blade components for faster rendering.

Frequently Asked Questions about blaze-optimize

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize Blade component rendering in Laravel?

Install livewire/blaze via Composer and register compilation paths with Blaze::optimize()->in() in AppServiceProvider. Blaze compiles anonymous Blade components into optimized PHP functions, reducing rendering overhead for component-heavy pages.

How do I memoize Blade components with Blaze?

Apply memoization to slot-free components without global state access that render many times with the same props, such as icons or badges. Use @blaze(memo: true) in the component or set memo: true on a directory in the service provider.

Does Blaze work with Livewire Flux components?

Yes, Blaze optimizes Flux components automatically once the package is installed, with no additional configuration needed. If the project also has its own anonymous components, those can be registered separately for compilation.

Which Blade components are incompatible with Blaze?

Blaze only supports anonymous components, so class-based components are excluded. Components using the $component variable, view composers or creators, View::share variables, or rendering via view() instead of component tags are also incompatible.

When should I not use folding in Blaze?

Do not fold components that access global state such as auth, session, request, errors, time, CSRF, database queries, config, or cache, since folding bakes output at compile time and produces stale HTML. Also avoid folding when there are no measured performance issues.

Why does a folded Blaze component show stale or broken output?

This usually happens when the component accesses global state or uses props in internal logic without correct safe/unsafe annotations. Remove the @blaze directive or add compile: false, and run php artisan view:clear after any changes.