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.
api-guard (691 stars, last release Oct 2016, zero dependents) is a well-understood reference implementation of API-key auth — key generation, hashed storage, configurable header/query-parameter lookup, middleware enforcement, and user-bound keys. The PM decision it informs is "what is the smallest correct key-management schema and middleware contract we need," not "should we add this to composer.json."Consider it when:
Look elsewhere when:
api-guard alongside Sanctum is strictly redundant.To executives: We evaluated api-guard as a shortcut to ship API-key authentication for partner integrations. It is a clean, MIT-licensed pattern, but it was last released in 2016 and has no downstream dependents, which means no security patching and no compatibility with our framework version. Recommendation: do not adopt as a dependency. Reimplement the same pattern on Laravel Sanctum, the maintained first-party equivalent. The delta is roughly a few engineering days for the backend and the real investment in the customer-facing key-management UI — which we would have had to build either way. Net effect: slightly longer to first release, materially lower long-term security and maintenance risk. Note the high opportunity score on this package is a useful market signal: simple API-key auth is still an underserved need in the Laravel ecosystem, which supports building the customer-facing management experience as a differentiator rather than treating keys as plumbing.
To engineering: Treat this repo as a design spec, not a dependency. The parts worth copying: keys stored hashed, never retrievable after creation; lookup via a configurable header with a query-parameter fallback for legacy clients (though we should decide deliberately whether to allow query-param keys at all — they leak into logs and referrers); validation in middleware with a single well-defined 401 contract; keys bound to an owning entity so revocation is a single row update. The parts to rebuild: framework integration, rate limiting, scopes/abilities, rotation with a grace window, and audit logging on create/use/revoke. Sanctum gives us the first four cheaply; the audit log and rotation flow are the genuinely new work.
To security and compliance: We are deliberately declining an unmaintained third-party auth dependency. It has no published advisories, no active maintainer response, and predates current PHP security baselines. The replacement is a first-party package plus an internal design review covering hashing, key display-once semantics, revocation and rotation, and logging hygiene (no keys in request logs). We will document this as a considered decision rather than an omission, which is the answer a customer security questionnaire is actually looking for.
How can I help you explore Laravel packages today?