Skip to main content
Livewire is a full-stack framework for Laravel that makes building dynamic interfaces simple without leaving the comfort of Laravel.
Laravel Data works excellently with Laravel Livewire.

Using Wireable (Traditional)

Use data objects as Livewire component properties:

Requirements

  1. Implement Wireable on your data class
  2. Use the WireableData trait

Livewire Synths (Experimental)

This is an experimental feature and subject to change.
Livewire Synths allow you to use data objects without making them Wireable. Enable in config/data.php:
Use data objects directly:

Lazy Properties

Lazy properties won’t be sent over the wire unless included.
Always include properties permanently because data objects are transformed and cast again between Livewire requests.
In your Livewire view:
You can query lazy nested data objects, but not lazy properties that aren’t data objects.

Validation

Laravel Data does not provide validation when using Livewire. You must implement validation yourself.
This is because laravel-data only validates payloads during creation, not existing data objects. The validation could technically happen when hydrating, but we cannot guarantee that every hydration happens with validated data.