Laravel Livewire
Agent Workflow (MANDATORY)
Before ANY implementation, spawn 3 agents in parallel, one Agent call each with a name:
- fuse-ai-pilot:explore-codebase - Check existing Livewire components
- fuse-ai-pilot:research-expert - Verify Livewire 3 patterns via Context7
- mcp__context7__query-docs - Check specific Livewire features
After implementation, run fuse-ai-pilot:sniper for validation.
Overview
| Feature |
Description |
| Components |
Reactive PHP classes with Blade views |
| wire:model |
Two-way data binding |
| Actions |
Call PHP methods from frontend |
| Events |
Component communication |
| Volt |
Single-file components |
| Folio |
File-based routing |
Critical Rules
- Always use wire:key in loops
- Use wire:model.blur for validation, not .live everywhere
- Debounce search inputs with .debounce.300ms
- #[Locked] for sensitive IDs
- authorize() in destructive actions
- protected methods for internal logic
Decision Guide
Component Type
Component choice?
├── Complex logic → Class-based component
├── Simple page → Volt functional API
├── Medium complexity → Volt class-based
├── Quick embed → @volt inline
└── File-based route → Folio + Volt
Data Binding
Binding type?
├── Form fields → wire:model.blur
├── Search input → wire:model.live.debounce.300ms
├── Checkbox/toggle → wire:model.live
├── Select → wire:model
└── No sync → Local Alpine x-data
Reference Guide
Core Concepts (WHY & Architecture)
| Topic |
Reference |
When to Consult |
| Components |
components.md |
Creating components |
| Wire Directives |
wire-directives.md |
Data binding, events |
| Lifecycle |
lifecycle.md |
Hooks, mount, hydrate |
| Forms |
forms-validation.md |
Validation, form objects |
| Events |
events.md |
Dispatch, listen |
| Alpine |
alpine-integration.md |
$wire, @entangle |
| File Uploads |
file-uploads.md |
Upload handling |
| Nesting |
nesting.md |
Parent-child |
| Loading |
loading-states.md |
wire:loading, lazy |
| Navigation |
navigation.md |
SPA mode |
| Testing |
testing.md |
Component tests |
| Security |
security.md |
Auth, rate limit |
| Volt |
volt.md |
Single-file components |
Advanced Features
| Topic |
Reference |
When to Consult |
| Folio |
folio.md |
File-based routing |
| Precognition |
precognition.md |
Live validation |
| Reverb |
reverb.md |
WebSockets |
Templates (Complete Code)
| Template |
When to Use |
| BasicComponent.php.md |
Standard component |
| FormComponent.php.md |
Form with validation |
| VoltComponent.blade.md |
Volt patterns |
| DataTableComponent.php.md |
Table with search/sort |
| FileUploadComponent.php.md |
File uploads |
| NestedComponents.php.md |
Parent-child |
| ComponentTest.php.md |
Testing patterns |
Quick Reference
Basic Component
class Counter extends Component
{
public int $count = 0;
public function increment(): void
{
$this->count++;
}
public function render()
{
return view('livewire.counter');
}
}
Volt Functional
<?php
use function Livewire\Volt\{state};
state(['count' => 0]);
$increment = fn() => $this->count++;
?>
<button wire:click="increment">{{ $count }}</button>
Wire Directives
<input wire:model.blur="email">
<input wire:model.live.debounce.300ms="search">
<button wire:click="save" wire:loading.attr="disabled">Save</button>
Best Practices
DO
- Use wire:key in @foreach loops
- Debounce search/filter inputs
- Use Form Objects for reusable logic
- Test with Livewire::test()
- #[Locked] for IDs, #[Computed] for derived data
DON'T
- wire:model.live on every field
- Query in render() method
- Forget authorization in actions
- Skip wire:key in loops
- Store sensitive data in public properties
Laravel 13 Notes
Livewire 4 sur Laravel 13
Livewire 4 est la version compatible Laravel 13. Changements clés :
- PHP 8.3 minimum (était 8.2 sur Livewire 3)
wire:model.live rate-limited par défaut (300ms debounce implicite)
#[Locked], #[Computed], #[On] toujours supportés
- Volt et Folio : versions majeures alignées (Volt 2, Folio 2)
- PreventRequestForgery : routes
/livewire/update gérées automatiquement, pas de config requise
Migration depuis Livewire 3
wire:poll.5s → toujours valide
$this->dispatch('event') → toujours valide
- Form Objects (
#[\Livewire\Attributes\Validate]) → API stable
1---2name: laravel-livewire3description: Livewire 4 reactive components on Laravel 13 - wire:model, actions, events, Volt, Folio. Use when building reactive UI without JavaScript.4versions:5 laravel: "13.0"6 livewire: "4.x"7 php: "8.3"8user-invocable: true9references: references/components.md, references/wire-directives.md, references/lifecycle.md, references/forms-validation.md, references/events.md, references/alpine-integration.md, references/file-uploads.md, references/nesting.md, references/loading-states.md, references/navigation.md, references/testing.md, references/security.md, references/volt.md, references/folio.md, references/precognition.md, references/reverb.md, references/templates/BasicComponent.php.md, references/templates/FormComponent.php.md, references/templates/VoltComponent.blade.md, references/templates/DataTableComponent.php.md, references/templates/FileUploadComponent.php.md, references/templates/NestedComponents.php.md, references/templates/ComponentTest.php.md10related-skills: laravel-blade, laravel-testing, laravel-api11metadata:12 source: https://skillmd.com/skills/fusengine/laravel-livewire13---1415<objective>16Covers Livewire 4 on Laravel 13: reactive class-based components with Blade17views, wire:model two-way binding and its modifiers (.blur, .live,18.debounce), actions, component lifecycle hooks, forms/validation, events19(dispatch/listen), Alpine.js integration ($wire, @entangle), file uploads,20component nesting, loading states, SPA navigation, testing, security21(auth/rate limiting), and the Volt (single-file components) and Folio22(file-based routing) sub-features, including Precognition live validation23and Reverb WebSocket integration.24</objective>2526# Laravel Livewire2728## Agent Workflow (MANDATORY)2930Before ANY implementation, spawn 3 agents in parallel, one `Agent` call each with a `name`:31321. **fuse-ai-pilot:explore-codebase** - Check existing Livewire components332. **fuse-ai-pilot:research-expert** - Verify Livewire 3 patterns via Context7343. **mcp__context7__query-docs** - Check specific Livewire features3536After implementation, run **fuse-ai-pilot:sniper** for validation.3738---3940## Overview4142| Feature | Description |43|---------|-------------|44| **Components** | Reactive PHP classes with Blade views |45| **wire:model** | Two-way data binding |46| **Actions** | Call PHP methods from frontend |47| **Events** | Component communication |48| **Volt** | Single-file components |49| **Folio** | File-based routing |5051---5253## Critical Rules54551. **Always use wire:key** in loops562. **Use wire:model.blur** for validation, not .live everywhere573. **Debounce search inputs** with .debounce.300ms584. **#[Locked]** for sensitive IDs595. **authorize()** in destructive actions606. **protected methods** for internal logic6162---6364## Decision Guide6566### Component Type6768```69Component choice?70├── Complex logic → Class-based component71├── Simple page → Volt functional API72├── Medium complexity → Volt class-based73├── Quick embed → @volt inline74└── File-based route → Folio + Volt75```7677### Data Binding7879```80Binding type?81├── Form fields → wire:model.blur82├── Search input → wire:model.live.debounce.300ms83├── Checkbox/toggle → wire:model.live84├── Select → wire:model85└── No sync → Local Alpine x-data86```8788---8990## Reference Guide9192### Core Concepts (WHY & Architecture)9394| Topic | Reference | When to Consult |95|-------|-----------|-----------------|96| **Components** | [components.md](references/components.md) | Creating components |97| **Wire Directives** | [wire-directives.md](references/wire-directives.md) | Data binding, events |98| **Lifecycle** | [lifecycle.md](references/lifecycle.md) | Hooks, mount, hydrate |99| **Forms** | [forms-validation.md](references/forms-validation.md) | Validation, form objects |100| **Events** | [events.md](references/events.md) | Dispatch, listen |101| **Alpine** | [alpine-integration.md](references/alpine-integration.md) | $wire, @entangle |102| **File Uploads** | [file-uploads.md](references/file-uploads.md) | Upload handling |103| **Nesting** | [nesting.md](references/nesting.md) | Parent-child |104| **Loading** | [loading-states.md](references/loading-states.md) | wire:loading, lazy |105| **Navigation** | [navigation.md](references/navigation.md) | SPA mode |106| **Testing** | [testing.md](references/testing.md) | Component tests |107| **Security** | [security.md](references/security.md) | Auth, rate limit |108| **Volt** | [volt.md](references/volt.md) | Single-file components |109110### Advanced Features111112| Topic | Reference | When to Consult |113|-------|-----------|-----------------|114| **Folio** | [folio.md](references/folio.md) | File-based routing |115| **Precognition** | [precognition.md](references/precognition.md) | Live validation |116| **Reverb** | [reverb.md](references/reverb.md) | WebSockets |117118### Templates (Complete Code)119120| Template | When to Use |121|----------|-------------|122| [BasicComponent.php.md](references/templates/BasicComponent.php.md) | Standard component |123| [FormComponent.php.md](references/templates/FormComponent.php.md) | Form with validation |124| [VoltComponent.blade.md](references/templates/VoltComponent.blade.md) | Volt patterns |125| [DataTableComponent.php.md](references/templates/DataTableComponent.php.md) | Table with search/sort |126| [FileUploadComponent.php.md](references/templates/FileUploadComponent.php.md) | File uploads |127| [NestedComponents.php.md](references/templates/NestedComponents.php.md) | Parent-child |128| [ComponentTest.php.md](references/templates/ComponentTest.php.md) | Testing patterns |129130---131132## Quick Reference133134### Basic Component135136```php137class Counter extends Component138{139 public int $count = 0;140141 public function increment(): void142 {143 $this->count++;144 }145146 public function render()147 {148 return view('livewire.counter');149 }150}151```152153### Volt Functional154155```php156<?php157use function Livewire\Volt\{state};158159state(['count' => 0]);160161$increment = fn() => $this->count++;162?>163164<button wire:click="increment">{{ $count }}</button>165```166167### Wire Directives168169```blade170<input wire:model.blur="email">171<input wire:model.live.debounce.300ms="search">172<button wire:click="save" wire:loading.attr="disabled">Save</button>173```174175---176177## Best Practices178179### DO180- Use wire:key in @foreach loops181- Debounce search/filter inputs182- Use Form Objects for reusable logic183- Test with Livewire::test()184- #[Locked] for IDs, #[Computed] for derived data185186### DON'T187- wire:model.live on every field188- Query in render() method189- Forget authorization in actions190- Skip wire:key in loops191- Store sensitive data in public properties192193---194195## Laravel 13 Notes196197### Livewire 4 sur Laravel 13198Livewire 4 est la version compatible Laravel 13. Changements clés :199200- **PHP 8.3 minimum** (était 8.2 sur Livewire 3)201- `wire:model.live` rate-limited par défaut (300ms debounce implicite)202- `#[Locked]`, `#[Computed]`, `#[On]` toujours supportés203- Volt et Folio : versions majeures alignées (Volt 2, Folio 2)204- **PreventRequestForgery** : routes `/livewire/update` gérées automatiquement, pas de config requise205206### Migration depuis Livewire 3207- `wire:poll.5s` → toujours valide208- `$this->dispatch('event')` → toujours valide209- Form Objects (`#[\Livewire\Attributes\Validate]`) → API stable