Stateful vs Stateless
Both modes can query, create, update and delete data. The only difference is whether the Linker transport keeps component state.
| Stateful (default) | Stateless | |
|---|---|---|
| Good for | Wizards, drafts, guarding a flow across calls | Server-side computation, queries, one-off commands |
| Mount data | alias + UUID + rev | alias + temporary signed URL |
| Cache | Required, with atomic locks | No Linker instance is created |
| Concurrency | The instance is locked; old revs get conflict | The same URL can run in parallel; writes rely on DB transactions, unique constraints, idempotency |
| Reload | A brand-new instance; state not in the DB is gone | A brand-new URL |
$this->set() | Available | No state to store |
Switching to Stateless
php
use App\Support\Linker\LinkerMode;
class QuoteLinker extends LinkerComponent
{
public static string $alias = 'quote';
public static function mode(): LinkerMode
{
return LinkerMode::Stateless;
}
#[Computable]
#[Validate(['qty' => 'required|integer|min:1', 'sku' => 'required|string'])]
public function price(array $args): LinkerResponse
{
return $this->ok(['total' => Pricing::quote($args['sku'], $args['qty'])]);
}
}The template is <div @linker('quote')> either way.
- Stateless accepts no mount params; put the scope into validated call arguments instead.
- The signed URL only proves integrity and expiry; it is not authorization. Login, CSRF, the signed user/alias/mode, Referer,
#[Computable],#[Authorize]and#[Validate]are all still checked.
Choosing
The repo has a full decision record on where wizard state belongs: docs/Linker/decision-wizard-state.md. /ticket/index shows both versions side by side for comparing the Network panel.
Deploying Stateful
Keep instances in their own cache store; otherwise php artisan cache:clear wipes forms in progress:
dotenv
LINKER_CACHE_STORE=linkerWhen scaling horizontally that store must be shared (Redis). Health checks:
bash
php artisan linker:list --healthbash
php artisan linker:list --health --allow-network-cache