chrisbjr/api-guard
API Guard is a Laravel package for API key authentication. It lets you generate and manage API keys, protect routes with middleware, and authenticate requests via configurable headers or query parameters, with hashed key storage and easy integration.
Architecture fit
auth.api), an Eloquent model plus published migration for an api_keys table, and a trait mixed into the User model for key generation/association. No external services, queues, or event dependencies.Integration feasibility
str_random() helper (Laravel 6), reliance on other deprecated str_/array_ helpers, middleware alias registration differences ($routeMiddleware vs Kernel/bootstrap/app.php), and any Auth::guard() assumptions.Technical risk
active boolean rather than expiry, rotation, or hashing. A database read (backup, replica, log, support dump) yields usable credentials. No built-in rate limiting or attempt throttling, so key enumeration/brute force is bounded only by whatever you add at the edge.?api_key= leak into access logs, proxies, and browser history.Key questions
Stack fit
Migration path
hash('sha256', $key), compare on lookup), add an expires_at column, enforce header-only transmission, and add per-key rate limiting at the middleware or gateway layer.api_keys table and the new personal_access_tokens table. This enables zero-downtime cutover.Compatibility
active flag semantics match your revocation expectations. Add an index on the key column if absent — likely a full-table scan per request otherwise.extra.laravel) on the target Laravel; on 5.4-and-earlier-era packages this is usually present but should be verified.Sequencing Client inventory → threat-model sign-off on plaintext storage → fork/harden or decide to migrate → bridge middleware → key re-issue campaign → deprecation telemetry → table drop. Migrate before any Laravel major-version upgrade; upgrading Laravel first will surface this package's compatibility debt at the worst possible moment.
Maintenance
Support
Scaling
api_keys table.Failure modes
Ramp-up
How can I help you explore Laravel packages today?