Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Bastion Laravel Package

juststeveking/laravel-bastion

Laravel Bastion gives your Laravel application a fortified foundation, bundling the conventions and groundwork you'd otherwise rebuild for every project so you can focus on shipping features. Lightweight, framework-friendly, and simple to drop into new or existing apps.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. Bastion targets a specific and legitimate slot: long-lived bearer credentials for machine-to-machine and partner-facing APIs, with Stripe-style semantics — environment-scoped keys, per-key scopes, revocation. That is distinct from Sanctum (first-party SPA/session tokens) and Passport (full OAuth2 grants and refresh flows). It fits when the credential subject is an organization, integration, or service rather than an end user, and when the product needs a test/live separation story that external developers already understand from Stripe. It does not fit consumer login, social sign-on, enterprise SSO, delegated authorization, or OAuth2. Adopting it also means operating a second authentication system alongside whatever authenticates humans — a real architectural cost that must be justified by an actual API or partner roadmap, not by convenience.

Integration feasibility. The install surface is small and conventional: composer install, publish config and migrations, add a trait to the authenticatable model, register a middleware alias, attach it to route groups with scope arguments. A Laravel engineer familiar with Sanctum completes a working spike in under a day. The expensive work is what the package deliberately leaves to the adopting team: key lifecycle policy, scope taxonomy, environment mapping, rotation and revocation workflow, and the customer-facing issuance experience. That is product and policy effort measured in weeks, and it should be planned and resourced as such — the library is the cheap part.

Technical risk. Ecosystem validation is thin: ~109 stars, zero dependents, a 0.0.2 release line, a single maintainer, and an opportunity score under 2. That is a statement about demonstrated production usage and audit history, not about code quality — but it shifts assurance work onto us. Mitigating factors are real: MIT license, a recognized Laravel community maintainer, a recent release (October 2025), and a codebase small enough to vendor or fork within days. Two risks outrank the rest. First, environment isolation must be enforced, not advisory — a test key accepted in live is a customer-trust incident, and must be proven in source with an explicit negative test rather than inferred from the marketing copy. Second, the supplied documentation is self-contradictory: the repository positioning describes API token authentication, while the packaged description describes an invitation/onboarding system. Resolve which capability the released code actually delivers before scheduling any evaluation sprint; it determines what is even being assessed and it must not reach a roadmap or a customer commitment unresolved.

Key questions.

  • Which description is accurate — bearer-token API auth, or invitation-based onboarding? Confirm against repository HEAD.
  • Are tokens stored hashed, with prefix-indexed or constant-time lookup rather than a table scan plus comparison?
  • Is environment isolation enforced inside the guard/middleware, or only at mint time by convention?
  • Do scopes actually gate requests in middleware, or are they inert metadata the application must check itself?
  • Does it coexist with Sanctum/Passport guards without collision, and can both run in parallel?
  • Is rotation supported with an overlap/grace window, or only hard revocation?
  • What is the supported Laravel/PHP matrix, and is there a semver commitment?
  • Is there CI and a test suite covering the security-critical paths?
  • Who runs this in production today?

Integration Approach

Stack fit. Best fit is a Laravel 10/11/12 API-first or API-plus-SPA application that must issue long-lived credentials to external consumers or internal services, and that needs per-key scopes plus test/live separation. Verify PHP and Laravel constraints against the actual runtime before committing. Poor fit where the only auth need is human login, where consumer mobile is the primary surface (Sanctum), or where OAuth2 grants are contractual.

Migration path. From Sanctum: schemas and semantics differ, so plan coexistence rather than conversion — issue Bastion keys alongside existing tokens, route by guard or key prefix, run both paths through a deprecation window (60–90 days for external consumers), then revoke legacy tokens on a published date. From nothing: adopt directly and skip the dual-path cost entirely. From Passport: only as part of an explicit decision to abandon OAuth2, which is a product decision, not a library choice.

Compatibility. Verify empirically, not by reading: (1) the guard and middleware do not collide with existing auth guards or auth:sanctum route groups; (2) migrations run cleanly on the target DB driver, including index and uniqueness assumptions on the key column; (3) scope enforcement composes with existing policies and gates instead of creating a second, divergent authorization layer that drifts from the first.

Sequencing.

  1. Resolve the documentation contradiction and confirm actual package scope in a throwaway app. Gate: no sprint until closed.
  2. Sandbox spike — mint, authenticate, enforce a scope, revoke, and attempt an environment-crossing key.
  3. Security read of source: hashing, comparison, isolation enforcement, expiry handling.
  4. Data model and migration plan, plus the parallel-run strategy and deprecation dates.
  5. Middleware wiring and a documented scope taxonomy mapped to route groups.
  6. Customer-facing issuance, rotation, and revocation workflow — the work the package does not do.
  7. Canary with internal or low-risk consumers for one release cycle, with pass/fail criteria agreed up front.
  8. GA with a written revocation runbook and a named owner for the token surface.

Operational Impact

Maintenance. Single-maintainer, small-footprint dependency with no vendor and no SLA. Pin the version exactly, schedule periodic source review rather than assuming passive safety, and treat a fork as a realistic contingency — the code is small enough that forking is days, not a quarter. Track releases manually; do not expect ecosystem pressure to surface breaking changes on your behalf. The 0.0.x version line argues for treating any upgrade as potentially breaking regardless of what the changelog states.

Support. Community-only. Nominate an internal owner for the token authentication surface and write the key lifecycle policy into our own runbooks, because the package will not supply it. Expect support volume to concentrate on customer-facing key management questions — where is my key, how do I rotate it, why is my test key failing in production — rather than on the library itself. Budget documentation as a deliverable with an owner, not an afterthought.

Scaling. One indexed lookup per authenticated request. With a proper index on the key hash, and a short-TTL cache of key-to-scope mappings if needed, this will not be the bottleneck; scope checks that trigger extra per-request queries on hot endpoints will be. Tens of thousands of keys are unremarkable; millions justify a caching layer and a design revisit.

Failure modes, ranked: environment isolation bypass — catastrophic to customer trust, so test it explicitly and negatively; auth table unavailability taking down all API traffic — confirm fail-closed behavior and mitigate with a read replica or cache; middleware applied to the wrong route group, leaving endpoints open or unusable; scope taxonomy drift producing over-permissive keys; maintainer abandonment with no internal fork capability; and a silent breaking change absorbed on upgrade.

Ramp-up. One engineer-day to a working spike for anyone with Sanctum experience; one to two engineer-weeks to a security-reviewed, production-shaped integration including the parallel-run strategy; two to four weeks of product and design effort for the customer-facing key management experience and scope taxonomy. Plan the policy work as the real cost and keep the dependency behind an internal auth interface so the implementation stays swappable and the exit remains cheap.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log