Skip to content

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 forWizards, drafts, guarding a flow across callsServer-side computation, queries, one-off commands
Mount dataalias + UUID + revalias + temporary signed URL
CacheRequired, with atomic locksNo Linker instance is created
ConcurrencyThe instance is locked; old revs get conflictThe same URL can run in parallel; writes rely on DB transactions, unique constraints, idempotency
ReloadA brand-new instance; state not in the DB is goneA brand-new URL
$this->set()AvailableNo 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=linker

When scaling horizontally that store must be shared (Redis). Health checks:

bash
php artisan linker:list --health
bash
php artisan linker:list --health --allow-network-cache