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 successThose 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
| Guarantee | How |
|---|---|
| The browser can only call methods you allow | Only #[Computable] methods exist; aliases are registered by hand |
| The browser can't change server state | Stateful state stays in the cache; the browser only has uuid + rev |
| Arguments are validated | Without #[Validate] no arguments are received |
| The server can't make the browser run arbitrary JS | Only a table of named actions; no eval |
| Error handling is written once | Failure shapes are fixed and linker.js handles them all |
Why not Livewire
| Livewire | Linker | |
|---|---|---|
| State | Round-trips with every request (snapshot + HMAC) | Only on the server; the browser holds a uuid |
| Exposed surface | All public methods and properties | Only #[Computable] |
| Returns | HTML diff | Data + 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
| Situation | Use |
|---|---|
| File bytes | FileDrop (the file id afterwards can go through Linker) |
| A large block of HTML | renderBlade (Linker returns render.fragment to ask for it) |
| Purely visual toggles | data-state-toggle |
| SEO or no-JS support | Ordinary 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.