vs Livewire
Livewire is the most direct point of comparison. Both let you write interactivity in PHP, but they answer "where does state live" and "what is exposed" differently.
Core differences
| Livewire | Linker | |
|---|---|---|
| State | Round-trips with every request (snapshot + checksum) | Only on the server; the browser holds uuid + rev |
| Exposed surface | A component's public methods and public properties | Only #[Computable] methods; properties don't exist in the browser at all |
| Arguments | Method arguments + bound properties | Only keys declared in #[Validate] |
| Returns | Re-rendered component HTML, morphed into the DOM | data + named actions; ask renderBlade when you need HTML |
| Server tells the browser | $this->js(), dispatched events | The action table (ui.toast, render.fragment…), no arbitrary JS |
| Errors | Validation errors built in; the rest custom | Fixed kinds, one front-end handler |
| Binding | wire:model two-way to a server property | data-state-bind to client state; the server only receives values when you call it |
The same feature, two ways
Livewire style
php
class TicketWizard extends Component
{
public int $step = 1;
public string $subject = '';
public function next()
{
$this->validate(['subject' => 'required|max:120']);
$this->step = 2;
}
}blade
<input wire:model="subject">
<button wire:click="next">Next</button>
@if ($step === 2) … @endifLinker style
php
class TicketLinker extends LinkerComponent
{
public static string $alias = 'ticket';
public function mount(array $params = []): void
{
$this->set('step', 1);
}
#[Computable]
#[Validate(['subject' => 'required|string|max:120'])]
public function next(array $args): LinkerResponse
{
$this->set('subject', $args['subject'])->set('step', 2);
return $this->ok(['step' => 2]);
}
}blade
<div @linker('ticket') @renderObject('ticket', ['state:read'])>
<form><input name="subject"></form>
<button data-linker-call="next" data-linker-args="form">Next</button>
<div data-state-is="step=2">…</div>
</div>What the differences buy you
Where Linker is safer
stepisn't in the browser. No need for "locked properties" or checksums to prevent tampering: the thing to tamper with doesn't exist.- Adding a public method doesn't accidentally create an endpoint. Forgetting
#[Computable]means "the feature doesn't work". - No eval path, so your CSP doesn't need
unsafe-eval.
Where Livewire is more convenient
- Ecosystem, docs, community, third-party components.
- Server properties are template variables directly; no need to separate "server state" from "client display values".
- Morphing preserves as much DOM as it can, so you don't have to think about fragment size.
Trade-offs
- Linker's Stateful instances live in a cache; multiple servers need a shared Redis.
- Instances disappear on reload. To resume, save a DB draft.