Skip to content

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 ​

LivewireLinker
StateRound-trips with every request (snapshot + checksum)Only on the server; the browser holds uuid + rev
Exposed surfaceA component's public methods and public propertiesOnly #[Computable] methods; properties don't exist in the browser at all
ArgumentsMethod arguments + bound propertiesOnly keys declared in #[Validate]
ReturnsRe-rendered component HTML, morphed into the DOMdata + named actions; ask renderBlade when you need HTML
Server tells the browser$this->js(), dispatched eventsThe action table (ui.toast, render.fragment…), no arbitrary JS
ErrorsValidation errors built in; the rest customFixed kinds, one front-end handler
Bindingwire:model two-way to a server propertydata-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) … @endif

Linker 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

  • step isn'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.