The Shift Toward Granular Request Tracking Debugging in Laravel has long been dominated by staples like Laravel Debugbar and Telescope, yet Trace-Replay introduces a distinct philosophy. Created by Ismile Azaran, this package functions less like a simple log and more like a flight recorder for your application. It excels at capturing the sequential flow of Livewire updates and HTTP requests, offering a dashboard that organizes complex processes into digestible timelines. While competitors provide a snapshot of state, Trace-Replay focuses on the journey of the data through your stack. Prerequisites and Integration To get started, you should have a solid grasp of Laravel architecture and modern frontend integration via Livewire. The package is designed for local development environments and aims to replace or augment existing debuggers. You will need a working Laravel 10 or 11 installation to utilize the tracing functions effectively. Essential Debugging APIs * **Trace-Replay**: The core package providing the dashboard and interceptors. * **OpenAI / Anthropic**: Optional drivers for automated error fixing. * **Ollama**: Local AI integration for privacy-focused debugging. Strategic Tracing in the Codebase Unlike Telescope, which often acts as a passive observer, Trace-Replay allows you to define explicit "checkpoints" within your logic. By using the following syntax pattern, you can isolate specific segments of a controller or component: ```php // Define the start of a logical process trace_replay_start('Booking Process', ['user_id' => $user->id]); // Perform sub-tasks trace_replay_step('Validating Slot'); // Finalize the trace trace_replay_end('Success'); ``` These tags allow the dashboard to group SQL queries and payloads under specific headers, making it infinitely easier to find which exact line of code triggered a problematic database call. AI-Driven Recovery and Replays The standout feature is the **Replay** button. When a request fails, you can modify your code and hit replay directly from the dashboard to compare the original 500 error with the new response. If the solution isn't obvious, the AI Fix Prompt generates a markdown-formatted context block optimized for LLMs like ChatGPT or Claude. It sends just enough metadata to provide a solution without bloating the token count, a significant efficiency gain over manual copy-pasting. Tips and Debugging Best Practices Always remember that Trace-Replay is a development tool; do not ship these trace functions to production. If you are seeing empty dashboards, ensure your local environment is correctly configured to log HTTP requests. For those who value privacy, hooking into Ollama allows you to use the AI fix features without your source code ever leaving your local machine.
LiveWire
Products
Laravel Daily (12 mentions) covers LiveWire within Laravel development, such as in "I Tried New Livewire Blaze for Blade Components (1.5x Faster?)". AI Coding Daily (2 mentions) mentions Livewire in the context of AI's impact on Laravel projects.
- May 4, 2026
- Apr 8, 2026
- Apr 8, 2026
- Apr 6, 2026
- Mar 29, 2026
Multi-tenancy arrives for Laravel starter kits Laravel 13 introduces a long-awaited feature to its official starter kits: native team functionality. This shift means developers no longer need to reach for Jetstream or build custom multi-tenant logic from scratch just to handle basic group permissions. The integration is baked directly into the installation process, allowing for immediate scaffolding of team creation, member invitations, and role-based access control. Understanding this implementation is vital for anyone building SaaS products where users must collaborate within isolated workspaces. Prerequisites and installation To use this feature, you must use the Laravel installer and select specific options. - **Livewire**: You must choose the Livewire starter kit. - **Class Components**: You must select **No** when asked if you want single-file functional components; the team's logic currently relies on standard Livewire class components. ```bash laravel new my-team-app Select Livewire -> Class Components -> Yes to Team Support ``` Database architecture and team logic The team system relies on three core tables. The `users` table gains a `current_team_id` to track which workspace the user is currently viewing. The `teams` table stores the owner and the team name. Finally, `team_invitations` handles the state of pending members. Under the hood, Laravel uses Fortify actions to handle the heavy lifting. When a user registers, the `CreateNewUser` action triggers a `CreateTeam` handle. This ensures every user has a personal "home" team by default, preventing null pointer errors when the application expects a team context. Invitation workflows and role hierarchy Accepting an invitation is currently a two-step process. A guest clicks a signed URL, which redirects them to a login or registration page. Once authenticated, the `AcceptInvitation` component validates the email match and attaches the user to the team. The system defines three specific roles: 1. **Owner**: Full control over settings and deletion. 2. **Admin**: Can rename teams and manage invitations. 3. **Member**: Read-only access to team data. Practical example: Role-based view logic You can check permissions directly in your Blade templates or Livewire components using the provided traits. This allows you to hide the "Delete Team" button from anyone who isn't an owner, a best practice for maintaining data integrity in collaborative environments. ```php @if (auth()->user()->ownsTeam($team)) <button wire:click="deleteTeam">Delete Team</button> @endif ``` Tips and common gotchas One notable quirk is the registration flow. If a user is invited via `[email protected]` but registers with a different email, they will not be automatically added to the team. Always ensure your users know the invitation is tied to the specific recipient email. Additionally, remember to run `php artisan queue:work`, as team invitations are dispatched as queued notifications by default.
Mar 29, 2026Audit your codebase with Laravel Boost Laravel Boost recently introduced a game-changing AI skill: **laravel-best-practices**. This tool isn't just a static linter; it’s an active agent that consults 189 specific rules across database performance, security, and Eloquent usage. Whether you are scaffolding a fresh Laravel project or auditing an older vibe-coded legacy application, this skill ensures your code adheres to modern ecosystem standards from the first line of code. Prerequisites and Tooling Setup To use these skills, you need a working knowledge of the Laravel framework and a CLI-based AI agent like Claude Code. You should be comfortable with terminal commands and composer-based installations. Key Libraries & Tools * **Laravel Boost**: A CLI tool that configures your development environment with specific AI skills. * **Claude Code**: The underlying AI agent that executes the analysis and code generation. * **laravel-best-practices**: The official skill containing rules for migrations, routing, and controllers. * **Laravel Daily Structure Audit**: A custom skill focused on architectural logic placement. Implementation and Skill Activation When installing Laravel, selecting the **Boost** option automatically injects the best practices skill. For existing projects, running `composer update` to reach version **2.4.1** or higher is necessary. Once active, you can prompt Claude Code to analyze your directory. The agent uses parallel sub-agents to read the 189 rule points without blowing through your token context window. ```bash Update and install the new skill on an existing project composer update boost install ``` Practical Syntax and Patterns The skill actively enforces patterns that prevent common technical debt. For example, it checks migrations for proper indexing and foreign key constraints: ```php // The skill ensures these patterns are used in generated code Schema::table('bookings', function (Blueprint $table) { $table->foreignId('user_id')->constrained()->cascadeOnDelete(); $table->unique(['user_id', 'service_id']); }); ``` In controllers, it pushes for **Form Requests** and **Route Model Binding** to keep methods clean. If you're building a CRUD, the AI uses `Route::resource` by default, ensuring your routing file doesn't become a bloated mess of individual GET and POST definitions. Insights from Real-World Audits In a test on a project upgraded to **Laravel 13**, the skill identified 32 issues, including eight high-severity points like missing rate limiting and **N+1 query** vulnerabilities. Interestingly, it even flagged errors in code previously generated by AI, such as a lack of error handling on **Stripe API** calls. This demonstrates that even AI-generated code requires a specialized "best practice" layer to be production-ready.
Mar 27, 2026Evolution of the Minimax Model Minimax M2.7 enters the arena as a direct successor to the Minimax M2.5, a model that previously struggled with complex Laravel architecture. Testing this new iteration reveals a clear upward trajectory in logic handling. While the older version failed nearly every specific backend task involving tenant isolation and package integration, the M2.7 shows signs of life, managing to successfully clear integration hurdles that previously stumped its predecessor. It is a noticeable step forward, though it still lacks the polish of established leaders. Automated Evaluation and Logic Flaws Testing the model against a multi-tenancy bug isolation task exposes critical weaknesses in how M2.7 interprets framework best practices. Instead of using native Laravel policies or established authorization patterns, the model resorted to manual gate denials and hard-coded exceptions in the controller. This approach creates a fragile codebase. Furthermore, it spent ten minutes "running in circles," attempting to fix Livewire and Flux UI issues it clearly did not understand. This indicates a lack of deep context regarding modern frontend components within the PHP ecosystem. Handling Complex Package Integration In a secondary test involving the Spatie Laravel Model States package, the model demonstrated mixed results. While it successfully scaffolded the state machine logic—a task where M2.5 failed entirely—the final implementation contained state mismatches. It hallucinated status names like "pending" and "shipped" instead of following the provided specification. Structurally, the code looked professional, utilizing form requests and try-catch blocks effectively. However, the presence of inline PHP in Blade templates suggests the model prioritizes functionality over clean MVC separation. Price vs. Performance Verdict The economic argument for Minimax M2.7 is its strongest selling point. Costing roughly $0.30 per million input tokens, it is exponentially cheaper than Claude 3 Opus or GPT-4. For small, repetitive agentic tasks, this price point is unbeatable. However, for high-stakes enterprise development, the reliability gap remains too wide. It provides excellent value for "good enough" code, but it is not yet a replacement for frontier models when architectural integrity is non-negotiable.
Mar 27, 2026Overview of Mobile Auth Architecture Building authentication for mobile applications using NativePHP requires a shift in how we handle state. Unlike a standard web application where the backend and frontend often share the same environment, a mobile app acts as a client to a remote API. This tutorial demonstrates how to bridge that gap by implementing traditional email/password login and Google Socialite integration. The goal is to secure your mobile application while ensuring a smooth user experience, even during intermittent connectivity. Prerequisites and Essential Tools Before diving into the code, ensure you have a solid grasp of Laravel and Livewire. You will need two distinct environments: * **Mobile Repository:** The NativePHP codebase that compiles into an APK or IPA. * **API Repository:** A separate Laravel backend (ideally hosted via Laravel Forge) to handle database persistence and authentication logic via Laravel Sanctum. Registration and Token Retrieval The registration process begins with a Livewire component. We capture user data and a unique device identifier using the NativePHP Device plugin. This ID allows the backend to track which specific device owns the session. ```php // NativePHP Livewire Component public function register() { $device = Device::info(); $response = Http::post('https://api.yourdomain.com/v1/auth/register', [ 'name' => $this->name, 'email' => $this->email, 'password' => $this->password, 'device_name' => $device['model'], ]); if ($response->successful()) { session(['token' => $response->json('token')]); return redirect()->route('home'); } } ``` On the backend, Laravel Sanctum generates a plain-text token upon successful validation. This token becomes the "key" for all subsequent requests. Managing Tokens and Offline Logic Security in mobile apps involves more than just checking if a token exists. You must verify it against the server periodically. However, mobile users often lose signal. A robust middleware should handle both verification intervals (e.g., every 15 minutes) and a "grace period" for offline access. ```php // Middleware Logic $lastVerified = session('token_verified_at'); if (now()->diffInMinutes($lastVerified) > 15) { try { $this->verifyTokenRemotely($token); } catch (ConnectionException $e) { // Allow offline access if verified within the last 24 hours if (now()->diffInHours($lastVerified) > 24) { return redirect()->route('login'); } } } ``` Social Auth with Deep Linking To implement Google sign-in, we use Laravel Socialite on the API side. The mobile app opens a browser instance to handle the OAuth flow. Once finished, the API redirects the user back to the app using a **Deep Link Scheme** (e.g., `nativephp://callback`). You must define this scheme in your `.env` file to ensure the mobile OS knows to hand the data back to your application. Storage Best Practices While using the PHP `session()` is functional for demos, it is not the most secure method. NativePHP offers a **Mobile Secure Storage** plugin. This paid add-on uses hardware-level encryption on the device to store tokens, ensuring they survive app reloads and provide a higher security tier than standard session files.
Mar 26, 2026Overview: The Shift Toward Code Literacy in 2026 Software development has reached a tipping point where the ability to read and verify code is becoming more valuable than the mechanical act of typing it. Laravel 13 remains the gold standard for PHP development by providing a structured, expressive environment that pairs perfectly with modern AI agents like Claude Code. This guide explores how to build functional web applications—from landing pages to authenticated CRUD systems—using Laravel as the backbone and AI as the engine. The core of the framework revolves around the Model-View-Controller (MVC) architecture. By separating the data logic (Models), the user interface (Views), and the glue that connects them (Controllers), Laravel creates a predictable environment. For developers in 2026, the goal is to understand these architectural pillars so they can direct AI agents effectively and debug the results with precision. Prerequisites and Environment Setup Before launching a new project, you must have a local PHP environment. The most streamlined recommendation is Laravel Herd, a zero-config development environment for macOS and Windows. It handles PHP, web servers, and local domain management effortlessly. Key tools you should have installed: * **PHP 8.3+**: The engine behind Laravel. * **Composer**: The package manager for PHP. * **Node.js & NPM**: Essential for compiling modern CSS and JavaScript. * **Database**: SQLite is the default for zero-config setups, but MySQL is preferred for scaling. Key Libraries & Tools * Laravel 13: The primary PHP framework. * Tailwind CSS 4: A utility-first CSS framework for rapid UI styling, pre-configured in new projects. * Vite: The modern frontend build tool that manages asset compilation. * **Eloquent ORM**: Laravel's built-in database mapper that allows you to interact with data using PHP syntax instead of raw SQL. * **Blade**: The powerful templating engine for generating dynamic HTML. * Pest: The elegant, human-readable testing framework now standard in the ecosystem. * Livewire: A full-stack framework for Laravel that builds dynamic interfaces without leaving the comfort of PHP. Code Walkthrough: Routing and Controllers The entry point for any Laravel request is the `routes/web.php` file. This file maps URLs to specific logic. In a clean architecture, we offload that logic to Controllers. ```php // routes/web.php use App\Http\Controllers\PostController; use Illuminate\Support\Facades\Route; // Basic GET route returning a view Route::get('/', function () { return view('welcome'); }); // Resource routing for CRUD Route::resource('posts', PostController::class); ``` The `Route::resource` command is a shortcut that automatically generates routes for index, create, store, show, edit, update, and destroy actions. Inside the `PostController`, we handle the interaction between the user and the database: ```php // App/Http/Controllers/PostController.php public function index() { // Fetching data via Eloquent $posts = Post::with('category')->latest()->paginate(10); return view('posts.index', compact('posts')); } ``` Database Integration and Eloquent Models Laravel uses Migrations to version-control your database schema. Instead of sharing SQL dumps, you share PHP files that define table structures. To define a relationship, such as a post belonging to a category, we use expressive PHP methods in the Model files. ```php // App/Models/Post.php class Post extends Model { protected $fillable = ['title', 'slug', 'content', 'category_id']; public function category(): BelongsTo { return $this->belongsTo(Category::class); } } ``` To populate these tables with test data, we use Factories and Seeders. Running `php artisan db:seed` allows you to instantly generate hundreds of realistic records, which is crucial for testing UI layouts and pagination. Syntax Notes: Route Model Binding A signature feature of Laravel is Route Model Binding. When you define a route like `/posts/{post}`, and type-hint the `$post` variable in your controller method, Laravel automatically fetches the record from the database. If the ID doesn't exist, it triggers a 404 page immediately without requiring manual `if` checks. Practical Examples 1. **Public Marketing Sites**: Using simple routes and Blade templates to manage high-performance landing pages. 2. **Content Management**: Utilizing Eloquent relationships to link authors, categories, and tags in a blog system. 3. **SaaS Dashboards**: Leveraging starter kits like Laravel Breeze or Jetstream to handle user authentication, profile management, and password resets out of the box. Tips & Gotchas * **Mass Assignment**: Always define `$fillable` or `$guarded` in your models to prevent malicious users from injecting data into fields like `is_admin`. * **Environment Security**: Never commit your `.env` file to version control. It contains sensitive database passwords and API keys. * **The N+1 Problem**: When listing records, use `with('relationship')` to eager load data. Forgetting this can cause your application to run hundreds of unnecessary database queries, tanking performance.
Mar 20, 2026Overview Laravel 13 introduces a significant shift in how developers configure classes by implementing 36 new PHP attributes. These attributes replace traditional protected properties—like `$fillable` or `$hidden`—with metadata directly above the class or method definition. This change aims to clean up class bodies and utilize native PHP 8 language features for better static analysis and cleaner syntax. Prerequisites To use these features, you should have a solid grasp of PHP 8 attribute syntax (`#[Attribute]`). You should also be familiar with Laravel's Eloquent ORM, job dispatching, and Artisan command structures. Key Libraries & Tools - **Laravel 13**: The latest version of the PHP framework. - **Eloquent**: The database mapper now supporting attribute-based model configuration. - **Livewire**: Often paired with these attributes in modern starter kits. Code Walkthrough Refactoring Eloquent Models Previously, you defined model behavior using class properties. In the new version, you apply them as attributes: ```php use Illuminate\Database\Eloquent\Attributes\Fillable; use Illuminate\Database\Eloquent\Attributes\Hidden; #[Fillable(['name', 'email'])] #[Hidden(['password'])] class User extends Model {} ``` Laravel reads these attributes at runtime, effectively populating the internal protected properties for you. Enhancing Queued Jobs For background tasks, you can now set retry limits and timeouts directly on the class: ```php use Illuminate\Queue\Attributes\Tries; use Illuminate\Queue\Attributes\Timeout; #[Tries(5)] #[Timeout(60)] class ProcessPodcast implements ShouldQueue {} ``` Syntax Notes Attributes utilize the `#[ ]` syntax. Unlike properties, attributes can take constructor arguments, allowing for cleaner configuration of complex settings like `ExponentialBackoff` within a single line. This moves configuration logic out of the class body and into the header. Practical Examples You can now define Artisan command signatures and descriptions without declaring variables: ```php #[Signature('app:send-emails {user}')] #[Description('Send a notification email to a specific user')] class SendEmails extends Command {} ``` Tips & Gotchas While Laravel now defaults to this style in its starter kits, these attributes are strictly optional. If you find multiple attributes on a single controller method hard to read, stick to the traditional `$middleware` arrays. Additionally, always ensure you import the correct namespace for each attribute to avoid "Attribute not found" errors.
Mar 19, 2026Overview of Managed Laravel Hosting Deploying a modern PHP application often requires juggling servers, SSL certificates, and database configurations. Laravel Cloud simplifies this by providing a serverless-style environment designed specifically for the Laravel ecosystem. By leveraging this platform, you can move from a local repository to a live URL in minutes, using a generous $5 free credit to explore high-performance infrastructure without upfront costs. Prerequisites To follow this guide, you should have a basic understanding of PHP and the Laravel framework. You will need a GitHub account to host your source code and a valid email address for signing up. No credit card is required to access the initial credits. Key Libraries & Tools * **Laravel Cloud**: The primary deployment platform for managed hosting. * **GitHub**: Used for version control and repository syncing. * **Livewire**: A full-stack framework for Laravel used in the starter kit to build dynamic interfaces. * **Valkey**: An open-source high-performance data store used for caching. * **PostgreSQL / MySQL**: Relational database options provided as managed resources. Deployment Walkthrough Setting up your environment involves connecting your source control and configuring your cluster. Repository Connection After signing up, connect your GitHub account. You can choose an existing project or use a starter kit like the Livewire template. Selecting a region close to your users minimizes latency. Resource Configuration Laravel Cloud automatically provisions an app cluster. For a cost-effective setup, choose the **Flex One CPU** tier. This tier is eligible for the free credit and supports **hibernation**. ```yaml Conceptual configuration for a Flex cluster cluster: type: flex-one-cpu hibernation: true idle_timeout: 15m ``` When your application receives no traffic, it enters a sleep state. This pauses billing, allowing your $5 credit to last significantly longer than a traditional always-on VPS. Syntax Notes: Domain Customization While custom domains require a paid plan, you can modify your free subdomain. The platform uses a `.l.cloud` suffix. ```text Change from default-id.l.cloud to: my-awesome-app.l.cloud ``` Practical Examples This workflow is ideal for shipping **MVP (Minimum Viable Products)** or side projects. You can attach a PostgreSQL database for persistence and a Valkey cache for session management, creating a full-stack environment that scales automatically as your traffic grows. Tips & Gotchas * **Enable Hibernation**: Always verify that hibernation is active in your app cluster settings to preserve your credits. * **Monitor Credit Usage**: Check the badge in the top right of the dashboard to see your remaining balance. * **Database Selection**: Use PostgreSQL for modern features or MySQL for traditional compatibility; both work seamlessly with the platform's auto-configuration.
Mar 10, 2026Overview of Visual Annotations Explaining visual changes to an AI agent often involves a clunky workflow of screenshots, manual uploads, and imprecise descriptions. Instruckt changes this by allowing developers to annotate DOM elements directly in the browser. Instead of guessing class names or describing a button's location, you click the element, add a note, and generate a markdown prompt that contains the exact technical context Claude Code needs to execute the change. This precision reduces the "hallucination" factor when AI attempts to style UI components. Prerequisites To follow this workflow, you should be comfortable with basic Laravel development and Tailwind CSS. You also need an AI agent capable of processing markdown context, such as Claude Code. Familiarity with Composer for package management is required for the installation steps. Key Libraries & Tools - **Instruckt-Laravel**: The specific adapter for Laravel applications. - **Instruckt Core**: A framework-agnostic JavaScript core that handles the annotation logic. - **Claude Code**: The CLI-based AI agent that receives the markdown feedback to modify the source code. - **Blade Components**: The templating engine used to inject the annotation toolbar. Implementation Walkthrough Installing the tool requires a quick pull via Composer. Run the following command in your terminal: ```bash composer require joshcirre/instruckt-laravel ``` Once installed, you must register the visual toolbar. In a Laravel environment, you typically place the Blade component at the bottom of your global layout file (e.g., `app.blade.php` or `welcome.blade.php`): ```html <x-instruckt /> ``` This tag renders a floating toolbar on your frontend. When you enter "Annotate" mode, the tool identifies the underlying Tailwind CSS classes and HTML structure of whatever you click. After adding notes, click "Copy Annotations as Markdown." You then paste this directly into your AI terminal. The agent sees a structured list of targeted elements and your specific instructions, allowing it to swap links or adjust font sizes with perfect accuracy. Syntax and Conventions The tool relies on the `x-instruckt` Blade component pattern, which is standard for modern Laravel packages. It intelligently scrapes Tailwind CSS classes from the DOM. If you are using Livewire, Instruckt offers specialized adapters to ensure the toolbar persists across reactive state changes. Tips & Gotchas Always wrap your Instruckt component in an environment check. You likely don't want the annotation toolbar appearing in production. Use a conditional check like `@env('local')` to ensure it only loads during development. If the agent fails to find an element, ensure your classes aren't being obfuscated by a minifier during the build process, as Claude Code needs those class strings to locate the correct line in your source files.
Mar 8, 2026The Quest for Automatic Refactoring Maintaining clean code remains one of the most taxing aspects of software development. Anthropic recently introduced a dedicated `simplify` command for Claude Code, aiming to bridge the gap between functional logic and elegant architecture. This feature doesn't just tweak syntax; it evaluates code quality, reuse, and efficiency through a multi-agent workflow. While standard LLM outputs often prioritize immediate functionality, this command attempts to mimic the secondary pass a human developer takes to polish a draft. Multi-Agent Architecture in Action The technical implementation of `simplify` involves three specialized review agents—Reuse, Quality, and Efficiency—running in parallel. These agents utilize Claude 3.5 Sonnet to perform the heavy lifting of code analysis before reporting back to a main Claude 3 Opus agent for final synthesis. In a Laravel project utilizing Livewire, this resulted in six specific architectural improvements, ranging from extracting shared form traits to converting repetitive HTML into reusable Blade components. Performance and Economic Realities Efficiency comes at a cost, both in time and tokens. The simplification process for a relatively small set of files took over eight minutes to complete. More significantly, a single session consumed roughly 5% of the total token limit on a high-tier $100 monthly plan. This raises questions about the practicality of running such deep-thinking agents frequently. While the suggestions—like replacing raw strings with model constants—are objectively better for maintainability, the overhead suggests this is a tool for final polish rather than continuous development. Strategic Refactoring vs. Procedural Hack A common critique, shared by developers like Corey, suggests that if the model is capable of writing better code, it should do so on the first attempt. However, the iterative nature of this tool mirrors the human development cycle. We rarely write the most optimized version of a feature while simultaneously solving the core business logic. By separating the "build" phase from the "simplify" phase, Claude Code ensures that the refactoring logic doesn't interfere with the initial generation of working code.
Mar 1, 2026Overview Blaze acts as a high-performance alternative for compiling Blade components within Laravel and Livewire projects. Developed by Caleb Porzio, this tool targets applications heavily reliant on repetitive UI elements—such as complex dashboards or dense data grids. By bypassing the standard rendering pipeline for designated components, it significantly reduces the execution time required to generate HTML, resulting in a snappier user experience. Prerequisites To implement this technique, you should have a solid grasp of the Laravel framework and its Blade templating engine. Familiarity with anonymous components and Livewire is essential, as the performance gains are most visible in component-heavy environments. Key Libraries & Tools * **Blaze**: The core package that optimizes component compilation. * **Laravel Blade**: The underlying templating engine being optimized. * **Blaze Debugger**: A built-in profiling tool to visualize render times and bottlenecks. Code Walkthrough Enabling Blaze Globally You can activate the optimization for specific directories within your `AppServiceProvider.php`. This tells the engine to apply specialized compilation to all components in that path. ```php public function boot(): void { // Optimize all components in the 'ui' folder Blaze::optimize('components/ui'); // Enable the visual debugger for local development Blaze::debug(); } ``` Targeting Specific Components For granular control, use the `@blaze` directive at the top of an individual component file. This allows you to opt-in to performance gains only where they are needed. ```blade @blaze <div class="task-row"> {{ $title }} </div> ``` Memoization Strategy For components like icons that appear hundreds of times with the same properties, the `memo` strategy provides a runtime cache. ```blade @blaze(['memo' => true]) <svg><!-- Icon Path --></svg> ``` Syntax Notes Blaze introduces the `@blaze` directive which can accept an array of options such as `['memo' => true]` or `['fold' => true]`. These directives must be placed at the very top of your `.blade.php` file to ensure the compiler handles them correctly before processing other HTML or Blade logic. Practical Examples In a dashboard displaying 1,000 tasks, each task might contain multiple sub-components like status badges, user avatars, and action icons. Standard Blade might take ~80ms to process this loop. By implementing Blaze on the `task-row` and `icon` components, you can slash render times down to ~35ms, effectively a 1.5x speed increase. Tips & Gotchas Always run `php artisan view:clear` after toggling Blaze settings in your environment file; otherwise, Laravel will continue serving the old, unoptimized cached views. Note that **class-based components** and components utilizing **slots** are currently unsupported by the more aggressive optimization strategies. Stick to anonymous components for the best results.
Feb 26, 2026