laravel/airlock
Laravel Airlock (now Sanctum) provides a featherweight authentication system for SPAs and simple APIs, offering token-based API auth and session-based SPA auth without the overhead of OAuth.
Architecture fit
laravel/airlock, but the repository (laravel/sanctum) and every changelog entry describe Laravel Sanctum. The v2.0.0 changelog states plainly: "Renamed package to Sanctum." airlock is the pre-2.0 name and has not been the shipping package name for many major versions. Any decision must be made against laravel/sanctum; laravel/airlock is a stale identifier, not a separate product./sanctum/csrf-cookie bootstrap, EnsureFrontendRequestsAreStateful middleware, and a stateful domain allowlist. Fits first-party SPAs on shared or subdomains.personal_access_tokens table, HasApiTokens trait, bearer tokens with abilities, optional expiry. Fits mobile clients, third-party integrations, service-to-service.auth.php guard configuration and coexists with policy/gate-based authorization. It is deliberately not a full OAuth2 server — if scopes, grants, refresh tokens, or delegated third-party consent are required, Sanctum is the wrong tool.Integration feasibility
composer require laravel/sanctum, publish config and migration, run migrations, add HasApiTokens to the authenticatable model, set SANCTUM_STATEFUL_DOMAINS and session domain, register the sanctum guard, and wire CORS supports_credentials. On Laravel 11+ this is largely covered by php artisan install:api.Technical risk
airlock is a plausible typosquat target on Packagist. Enforce that only laravel/sanctum is required in composer.json, and pin via lockfile.SANCTUM_STATEFUL_DOMAINS / SESSION_DOMAIN / CORS credentials yields 401/419 with opaque causes. v4.1.0 and v4.1.1 specifically addressed same-domain stateful detection and host/port inconsistency — a signal this is a recurring production failure.last_used_at write amplification. Per-request updates to the token row are a hot-write pattern; v4.3.0 added optional last_used_at tracking configuration specifically to let teams disable it.Dependents: 0 is clearly wrong for a package bundled in the Laravel skeleton, and the 2026-07-21 last-release date is future-dated relative to review — treat both as metadata defects, not product signals.Key questions
sanctum:prune-expired scheduled?last_used_at tracking needed for security forensics, or should it be disabled for write throughput?Stack fit
personal_access_tokens; the session driver must be non-null and shared across app instances (Redis or database) for stateful mode to work behind a load balancer.Migration path
laravel/airlock reference survives in composer.json or lockfile; replace with laravel/sanctum at the version matching the Laravel major.composer require laravel/sanctum; publish config and migration; run migrations.HasApiTokens to the user model; register the sanctum guard in config/auth.php.sanctum as an additional guard so routes can be flipped incrementally.Compatibility
SANCTUM_STATEFUL_DOMAINS, config/cors.php supports_credentials => true, and withCredentials on the HTTP client must all agree. Same-site deployments are the low-risk path; cross-site requires SameSite=None; Secure.CheckAbilities, CheckForAnyAbility) and the v4.0.7 tokenCant() helper cover the authorization surface; route-model authorization should stay in policies, not abilities.Sanctum::actingAs($user, ['ability']) replaces hand-rolled auth fakes. Adoption requires updating existing feature-test helpers.Sequencing
Do steps 3–6 before touching production traffic; step 4 is the highest-probability failure point and should be validated in a staging environment that mirrors the real cookie topology.
Maintenance
config/sanctum.php to the Pint skeleton format) — cosmetic, but they create diff noise on upgrade.Support
MissingScopeException annotated deprecated in v3.2.6) but the changelog style is terse — many entries are single-line PR titles with no upgrade guidance. Budget engineering time to read diffs, not release notes.Scaling
last_used_at write. Disable it via the v4.3.0 configuration option on high-throughput APIs; if retained, expect write pressure concentrated on a single hot table.sanctum:prune-expired (expiry pruning added in v3.0.1) is actually scheduled. This must be a shipped, monitored cron job, not a documentation footnote.Failure modes
/sanctum/csrf-cookie bootstrap or wrong session domain.Ramp-up
last_used_at both enabled and disabled.How can I help you explore Laravel packages today?