Search by

maarheeze / uuid-livewire

wietsewarendorff

livewire integration for a simple uuid value object

Package info

github.com/maarheeze/uuid-livewire

pkg:composer/maarheeze/uuid-livewire

Statistics

Installs: 158

Dependents: 0

Suggesters: 2

Stars: 0

Open Issues: 0

3.0.1 2026-09-04 14:46 UTC

This package is auto-updated.

Last update: 2026-09-04 14:47:20 UTC


README

Livewire integration for maarheeze/uuid.

Livewire serializes component properties between requests. Without this package, it does not know how to handle Uuid value objects and will fail when one is used as a property. This package registers a property synthesizer that teaches Livewire how to serialize and deserialize Uuid instances automatically.

Installation

composer require maarheeze/uuid-livewire

Usage

Custom Livewire components

Declare a Uuid property directly — no manual conversion needed.

use Livewire\Component;
use Maarheeze\Uuid\Uuid;

class ShowArticle extends Component
{
    public Uuid $articleId;
}

Typed identifiers

Typed identifiers — your own classes using the IsUuid trait — are supported the same way, and keep their own type across requests. A PlayerId property hydrates back as a PlayerId, never as a plain Uuid.

use Livewire\Component;
use App\Player\PlayerId;

class ShowPlayer extends Component
{
    public PlayerId $playerId;
}

This also covers properties updated from the browser, such as wire:model bindings and url parameters.

Filament

Filament pages are Livewire components. When a Filament resource uses a Uuid as its primary key, Livewire needs to serialize it between requests — for example, when loading an edit page. Without this package, Filament will fail to keep track of the record.

use Filament\Resources\Resource;
use App\Models\Article; // model with a Uuid primary key

class ArticleResource extends Resource
{
    protected static string $model = Article::class;
}

No additional configuration is required in either case — installing this package is enough.

License

MIT