nawasara/auth-primitives
Lightweight Laravel/PHP auth primitives package providing foundational building blocks for authentication and authorization. Use it to compose your own login flows, guards, and access rules with minimal opinionated structure.
Hash, Sanctum, Passport). This package may introduce redundancy unless it offers unique features (e.g., zero-trust auth, novel cryptographic schemes, or compliance-specific tools like GDPR-friendly tokenization).generateJWT(), verifyPassword()), it may require significant wrapper logic to integrate with Laravel’s existing auth stack (e.g., Illuminate\Auth). Conversely, if it’s a higher-level abstraction, it could replace parts of Laravel’s auth system, risking tight coupling.firebase/php-jwt, paragonie/sodium), there’s a risk of version conflicts with Laravel’s core or other packages (e.g., laravel/sanctum). A composer.json review is critical.Auth::attempt()). The effort to backport Laravel’s auth logic to this package’s API may outweigh benefits.hashPassword(), validateToken()) is mandatory.Hash::make() or Sanctum for high-throughput APIs?Auth::attempt() + package’s verifyCredentials()).AuthManager, Hasher)?Redis) for token storage?auth:api)?users table), conflicts with Laravel’s migrations may arise.| Step | Priority | Dependencies | Risk Mitigation |
|---|---|---|---|
| Audit package code | P0 | None | Use phpstan, psalm, manual review. |
| Set up PoC module | P1 | Laravel auth config | Isolate in a feature branch. |
| Benchmark performance | P1 | PoC results | Compare with AB tests. |
| Document gaps | P1 | PoC findings | Create RFC for team alignment. |
| Full integration | P2 | Stable PoC, team buy-in | Roll out behind feature flags. |
rhumsaa/uuid).auth.log or a custom monitor.select * from auth_tokens) could outpace Laravel’s Eloquent optimizations.| Failure Scenario | Impact | Mitigation Strategy |
|---|---|---|
| Package introduces security flaw | Data breach, compliance risk | Isolate behind WAF, monitor for exploits. |
| Incompatible with Laravel 10+ | App breaks on upgrade | Use laravel/framework version constraints. |
| Poor error handling | Silent failures in auth | Add custom middleware to log auth errors. |
| Vendor abandonment | No updates, security risk | Fork critical components. |
AuthPrimitive::generate() vs. Str::random()).How can I help you explore Laravel packages today?