Skip to content

Linker Overview ​

Write interactivity in PHP. The front end contains no business logic and no error handling.

The problem ​

How many places does a traditional "save customer" button touch?

Route → Controller → FormRequest → JsonResource
  ↓
Front end: build the request, send it, check the HTTP status, split 422 errors onto fields,
           show "no permission" on 403, "please reload" on 409, an error card on 500, reload the list on success

Those last seven jobs are rewritten for every module, and everyone writes them a little differently. The actual business is just "store one customer".

Linker removes that layer: PHP writes the business logic; the front end has a single, shared receiver (linker.js).

What one call looks like ​

What it guarantees ​

GuaranteeHow
The browser can only call methods you allowOnly #[Computable] methods exist; aliases are registered by hand
The browser can't change server stateStateful state stays in the cache; the browser only has uuid + rev
Arguments are validatedWithout #[Validate] no arguments are received
The server can't make the browser run arbitrary JSOnly a table of named actions; no eval
Error handling is written onceFailure shapes are fixed and linker.js handles them all

Why not Livewire ​

LivewireLinker
StateRound-trips with every request (snapshot + HMAC)Only on the server; the browser holds a uuid
Exposed surfaceAll public methods and propertiesOnly #[Computable]
ReturnsHTML diffData + named actions
Server tells the browser$this->js() (effectively eval)Named action table

The cost: in Stateful mode the server stores state (cache, 30-minute TTL), and scaling horizontally needs a shared Redis.

More detail in vs Livewire.

What should not go through Linker ​

SituationUse
File bytesFileDrop (the file id afterwards can go through Linker)
A large block of HTMLrenderBlade (Linker returns render.fragment to ask for it)
Purely visual togglesdata-state-toggle
SEO or no-JS supportOrdinary routes + form POST

Progressive enhancement: keep type="submit" on the button and the <form action>. Without JavaScript the normal route handles it; with JavaScript, Linker takes over.

Next: Template Attributes. To build a component hands-on, see Your First Linker Component.