devtical/filament-sanctum
Manage Laravel Sanctum API tokens directly from your Filament panel. Create, list, and revoke personal access tokens, define custom abilities and expiration presets, restrict access with gates, and display the page in the sidebar or user menu.
Architecture fit. This package is a presentation-layer plugin, not an authentication component. It registers via SanctumPlugin::make() in a Filament panel provider and reuses Sanctum's native personal_access_tokens table — no parallel guard, no second token format, no proprietary migration. That containment is the central fact for a TPM: the blast radius of a failure is the admin panel's token screen, not the API itself. Remove the package tomorrow and issued tokens keep working; only the in-panel affordance to mint and revoke them disappears. The package also draws the right seam between capability and policy — it renders the management UI and delegates "who may see this" to a configurable Laravel gate (authorization.enabled + authorization.gate). That is the correct division of responsibility and is what makes it governable rather than something that quietly widens your attack surface.
Integration feasibility. Standard Laravel/Filament choreography: composer require devtical/filament-sanctum laravel/sanctum, publish Sanctum's provider and migrate (only if Sanctum is not already live), add HasApiTokens to the User model, register the plugin, optionally publish config/translations, then define the gate. Realistic effort: 2–4 hours when Sanctum is already installed and a gate/policy convention exists; 1–2 dev days when the ticket also carries standing up Sanctum, agreeing the authorization model, validating multi-panel or multi-tenant behavior, and socializing the fact that all historical tokens become visible in the panel on day one. The build comparison is unfavorable: a bespoke screen means form + abilities picker + one-time token reveal + revoke action + tests + i18n, roughly 10–20 dev hours, plus permanent ownership. Buy-over-build is the clear call here.
Technical risk. Ranked for a decision memo:
Key questions. (1) Which panel(s) get the plugin, and is access gated — if so, by which gate and who owns the gate's definition and test? (2) Is the token listing scoped to the authenticated user, and does that hold under impersonation or tenant switching? (3) Are we comfortable exposing all pre-existing tokens to panel operators, or do we need a cutoff/backfill conversation first? (4) Do we define abilities as a fixed enum in config, or do we need them to vary per role — and if per-role, is the config file the right home? (5) What is our acceptable maintenance posture for a single-maintainer dependency: pin, vendor, or absorb on a trigger? (6) Does the panel's audit/logging requirement cover token creation and revocation, or must we observe those events ourselves?
Stack fit. The package only imposes obligations where Sanctum is absent. If the API tier already runs Sanctum, the surface area is one panel plugin registration plus a config file; the only model change is the HasApiTokens trait, which a Sanctum-fronted API usually already has. If Sanctum is not yet deployed, this ticket quietly inherits the full Sanctum rollout — provider publication, migrations, CORS/domain configuration, and whatever token-issuance flows exist outside the panel. A TPM should split those into separate work items so the panel plugin is not carrying an unrelated platform migration on its back.
Migration path. Effectively a greenfield add-on with no data migration of its own. The two things worth pre-empting: (a) the plugin is additive, so rollback is composer remove plus a config revert — plan the reversal before the rollout, not after; and (b) the "historical tokens appear immediately" behavior is not a migration step but behaves like one, so announce it to whoever owns the security review and to any support staff fielding user questions about unfamiliar tokens in their list.
Compatibility. Support is a matrix, not a boolean, and the docs are behind the code. Confirm the exact tested combination before committing: Filament 3/4 + Sanctum v4 at v1.0.0, Filament 5 + Laravel 13 at v1.1.0. Pin a specific release in composer.json, record the matrix in the repo README or an ADR, and add a CI job that exercises the panel's own test suite against the pinned versions so a Filament minor bump surfaces as a build failure rather than as a broken admin page. Treat Filament minor releases as needing a verification pass, since the changelog shows real breakage from Filament internals (MenuItem → Action, TagsColumn → TextColumn) across major versions.
Sequencing. Five stages, each independently shippable:
/admin/admin/sanctum URL-resolution fix.columns, list), expiration defaults and presets (allow_expiration, default_expiration_days, expiration_presets), and publish translations if EN/ID coverage is insufficient.Maintenance. Low in absolute terms but non-zero and concentrated in one place: version-drift between Filament and this plugin. The package has a real changelog and release cadence (0.0.1 → 1.1.0 with meaningful fixes shipped, including a duplicate-path URL bug and a column-rendering bug found in production use), which is reassuring; but the dependency chain is Filament → plugin → your panel, and the plugin's release timing is not on your schedule. Budget a small recurring line item — a few hours per Filament upgrade cycle — and assign a named owner. Keep a documented "absorb it" path: at this code size, forking the resource class into the app is a 1–2 day task, which makes the whole dependency bounded rather than open-ended.
Support. First-line support lands on the panel's own admins and then on whoever owns the API tier, because the questions users ask ("what is this token?", "why did my integration stop working?") are Sanctum questions wearing a Filament UI. Prepare a short runbook: what tokens are, that revocation is immediate and irreversible, that the plaintext is shown exactly once at creation, and how to escalate a suspected token compromise (revoke, rotate, audit). The plugin's contributor email in the security section is a single human — do not design an incident process that depends on their response time.
Scaling. The mechanics scale fine: token creation and revocation are rare, single-row operations against an indexed table, and the listing paginates through Filament's table primitives. The real scaling concern is organizational, not technical — token count per user and ability granularity grow with the number of integrations. If the abilities list is a config-file enum, it stays legible; if every team wants its own scopes, the config becomes a coordination bottleneck and you should plan for the list to be governed by a code-owning team rather than edited ad hoc. Multi-panel and multi-tenant deployments need explicit verification: confirm the resource scopes to the current tenant/panel user, because that behavior is exactly what the docs leave implicit.
Failure modes. Worth naming explicitly, each with a mitigation:
allow_expiration off) → long-lived tokens with no policy enforcement. Mitigate by aligning default_expiration_days and expiration_presets with the API tier's documented token policy before rollout, not after the first audit.Ramp-up. Fast for anyone fluent in Filament: install is copy-paste from the README, and the config file is small and self-describing. The genuine learning isn't the package — it's the Sanctum mental model (hashed storage, one-time plaintext reveal, ability scopes, last-used semantics) and the panel's authorization convention. Plan half a day of reading plus a staging walkthrough for the implementing engineer, and a 15-minute briefing for panel admins on what changed and what revocation means. Do not skip the briefing: the first time a non-technical operator revokes a production integration's token, you will want them to have already known that there is no undo.
How can I help you explore Laravel packages today?