joe-404/laravel-auth
Drop-in, config-driven authentication for Laravel 12 and 13: OTP and magic-link verification, login, token refresh, password reset, multi-session management, Google OAuth, API tokens, account status workflow, and referral codes via a uniform JSON API.
Architecture fit. The package is a Laravel service provider that ships routes, migrations, config, events, and a response-formatting contract — a conventional, well-shaped Laravel package. It explicitly targets Laravel 12/13 with PHP 8.2+, pulls Sanctum 4, Socialite 5, and Spatie Permission 6 transitively, and mounts a ~60-endpoint JSON API under /auth (configurable prefix). For a greenfield, API-first Laravel service with no existing auth, it is close to a "install and go" fit. For anything with an existing users table, Sanctum setup, or permission model, the fit degrades sharply: the package requires four traits on the User model (HasApiTokens, HasRoles, SoftDeletes, HasAccountStatus), owns its own migrations, and assumes its own route namespace.
Integration feasibility. Mechanically easy, organizationally hard. composer require + php artisan auth:install + trait additions is a sub-day spike. The real cost sits in three places: (a) the schema footprint — account status, sessions, device history, trusted devices, referrals, audit logs, 2FA methods, backup codes, API tokens all land in the database and are non-trivial to unwind; (b) the response envelope contract, which will dictate frontend error handling and is only reshapable via ResponseFormatterContract; (c) the transitive Sanctum/Socialite/Spatie installs, which will collide with any pre-existing configuration of those packages.
Technical risk. Material, and concentrated in one place: this package owns the entire authentication and session boundary. Ranked:
v2.6 feature milestones while simultaneously carrying a "BETA / TESTING" banner. Version numbers and stability claims are contradictory — an unreliable signal for upgrade-cadence planning.Key questions. Does a published test suite exist and what does it cover — particularly refresh-token reuse detection, OTP expiry/replay, and 2FA challenge binding? Are migrations additive-only, or do they alter a pre-existing users table? How are OTPs and refresh tokens stored, and is Redis a hard requirement or a recommendation? What is the maintainer's stated support/security-disclosure policy? Has anyone other than the author run this in production? What happens to active sessions if the package is removed?
Stack fit. Strong for a greenfield Laravel 12 API/SPA/mobile-backend with Redis already provisioned and no legacy auth. Weak for a brownfield app with an established users table, existing Sanctum tokens in the wild, or Spatie roles already configured — in that case the package becomes an overlay you must reconcile, not a drop-in.
Migration path. Do not adopt as a production dependency on the first pass. Sequence it as three discrete gates:
Compatibility. Verify three things before committing: that the four required traits do not conflict with existing traits or model casts; that routes.prefix cleanly avoids collisions with your current API surface; and that the transitive Sanctum/Socialite/Spatie constraints resolve against your composer.lock. The optional Reverb integration should be treated as out of scope for v1 — it adds websocket infrastructure for a non-critical latency improvement on OTP delivery.
Sequencing. Auth is a platform dependency, not a feature. Land it before feature work that assumes identity (referrals, 2FA-gated endpoints, admin status workflows) rather than after, and treat the response envelope as a published contract to the frontend team on day one. If forking, do it before any application code depends on the upstream namespace — the namespace change is cheap early and expensive late.
Maintenance. Effectively yours, regardless of what you choose. With one maintainer and zero dependents, there is no upstream community to absorb bug reports or review PRs. Budget for a named internal owner, a pinned version, and a quarterly review of upstream activity. If the repo goes quiet for two release cycles, the fork decision is forced — plan for it rather than discovering it during an incident.
Support. No SLA, no commercial backing, issue-tracker-only support. Authentication failures are P0 by definition (nobody can log in), so the support burden lands entirely on your on-call rotation with no escalation path. The practical mitigation is deep familiarity: at least two engineers must be able to read the config surface and trace a failing login end-to-end without upstream help.
Scaling. Redis is load-bearing — OTP storage, refresh-token families, and rate limiting all lean on it, so Redis availability becomes an auth availability dependency. Token refresh is a write on every rotation; refresh-token family tracking grows unbounded unless pruned. Session and permanent device-history tables accumulate per-login and per-device respectively and will need retention policy. The ResponseFormatterContract gives you a clean seam for shaping responses at scale; the referral anti-abuse heuristics do not scale well and should be treated as advisory, not enforcing.
Failure modes. The high-severity ones: OTP or magic-link email delivery failure silently locks new users out of registration with no fallback path; aggressive lockout or rate-limit thresholds deny service to legitimate users under shared-IP conditions (corporate NAT, mobile carriers); refresh-token reuse detection revoking an entire token family triggers mass forced logout when a client retries incorrectly; account-status middleware misconfiguration turns a single user's suspension into a broader auth outage; magic-link tokens exposed via URL in logs or referrer headers. Each needs an explicit runbook entry and, where possible, a kill switch in config before go-live.
Ramp-up. The learning curve is broad rather than deep — a large config surface (config/auth_system.php), a sizable event taxonomy, pluggable contracts for response formatting and SMS drivers, and a three-step registration flow that differs from Laravel's default. The README and docs/ are above average for a package this size, but they document intended behavior, not tested behavior, and there is no evidence of third-party validation. Allocate a real onboarding task for the second engineer, and write an internal integration note covering your specific configuration, trait setup, and the deviations you made — that document, not the upstream README, becomes the source of truth the moment you fork or pin.
How can I help you explore Laravel packages today?