rinvex/laravel-auth
Rinvex Laravel Auth is a flexible authentication and authorization package for Laravel, offering user management, roles and permissions, email verification, password resets, and social login with customizable, ready-to-use flows.
Before you do anything else: this package is archived and unmaintained. Open composer.json in the repo and compare its laravel/framework and illuminate/* constraints against your app. If you're on Laravel 8+, expect to either pin an old Laravel, vendor-fork the package, or walk away. For most greenfield work, the honest first move is to look at what you're trying to get (RBAC + 2FA + social) and ask whether Fortify + spatie/laravel-permission + Socialite covers it with less risk.
If you're committing anyway — typically to maintain an existing app built on it — the first-day steps are:
composer require rinvex/laravel-auth (pin the exact version; nothing here will get upstream fixes).php artisan vendor:publish --tag="rinvex-auth" and --tag="rinvex-auth-migrations" (confirm tag names with php artisan vendor:publish listing — they've shifted across releases).config/auth.php-adjacent config file immediately. It controls models, tables, guards, features (2FA, social, verification), and middleware. This is the real source of truth for how the package behaves in your app.users table.User model or apply its traits (HasRoles-style traits for role/ability checks, plus auth-related traits) to your existing model. Read the trait source before trusting it.First use case to prove out: take a stock Laravel User, attach the traits, seed two roles (admin, member), assign one, and gate a route with the package's role middleware. If that works end-to-end in an hour, the rest (2FA, social) is a sequence of similar wiring jobs. If it doesn't, stop — the cost of debugging an abandoned auth layer compounds.
RBAC as your authorization backbone. The package exposes roles, abilities/permissions, and the pivot relationships between them. The daily pattern is: define abilities at seed time (or via a migration), attach them to roles, attach roles to users, then check with $user->hasRole(...), $user->can(...), or via Laravel's Gate. Prefer registering the package's checks with Gate::before / Gate::after so @can and $this->authorize() keep working — you don't want a second, parallel authorization vocabulary in your controllers.
Middleware for coarse checks, policies for fine ones. Use the package middleware for "is this user in admin?" at the route group level. Keep resource-level rules (can this user edit this post?) in Laravel policies; the package shouldn't own that logic. Mixing the two is where teams get confused.
2FA as an explicit flow. Model it as three states — disabled, pending verification, enabled — and store the secret only after the user successfully verifies a code. Wire it into login via an event/listener or a middleware that checks the 2FA column on the user and redirects to a challenge route. Never let the login response complete before the TOTP check; the package's traits give you the primitives, not the full UX.
Social auth via Socialite, not via the package's abstractions alone. Configure providers in the package config, but be prepared to call the package's social callback handling directly. Map provider identities to local users deliberately — decide up front whether you auto-create users on first social login and how you handle email collisions with existing accounts.
Verification (email/phone) as a trait concern. Treat it like Laravel's MustVerifyEmail: a column, a middleware, and a resend route. The package's verification pieces are the storage and token handling; the routing and throttling are yours.
Testing. Because the authorization surface is trait methods, unit tests are cheap: build a user, assign roles, assert hasRole/can. Integration tests for 2FA need a fake TOTP secret and clock control — pin the secret in a factory state rather than generating one per test.
users schema. If you've customized columns or use UUIDs, edit the published migrations before the first migrate rather than patching after.php artisan config:cache after changing the config file is a classic "why is 2FA suddenly disabled?" moment. Clear it in deploy scripts.web guard. If you're behind api/Sanctum, verify the guard is threaded through both the config and your route definitions; otherwise auth middleware passes while the package's checks see an unauthenticated user.vendor/rinvex/laravel-auth/src/. This is the single fastest way to answer "does this method exist?"php artisan tinker to dump $user->getRoles() / permission collections, and temporarily register a Gate::before logger. Route-level php artisan route:list --path= confirms middleware order.use Trait { method as protected; } aliasing) are your levers. Prefer overriding in your User model over editing vendor files — but since vendor is frozen, a fork is more honest than a shim.How can I help you explore Laravel packages today?