A Laravel package for authenticating RESTful APIs with API keys, featuring built-in transformers and validation.
ApiGuard is a Laravel package designed to authenticate RESTful APIs using API keys. It provides middleware to protect routes, tools for generating and managing keys, and integrates with Fractal for standardized JSON responses. It solves the need for a simple, integrated API authentication solution in Laravel applications before native features were available.
Laravel developers building RESTful APIs that require API key-based authentication, especially those using Laravel versions prior to 5.8.
Developers chose ApiGuard for its ease of integration, built-in support for transformers and validation error handling, and polymorphic key management linking API keys to models like users.
A simple way of authenticating your RESTful APIs with API keys using Laravel
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
API keys can be attached to multiple models using the Apikeyable trait, enabling flexible associations for users or other entities without custom code.
Integrates seamlessly with Fractal transformers to deliver standardized, customizable JSON API responses, as demonstrated in the controller examples.
Middleware like auth.apikey allows quick securing of API routes with minimal configuration, shown in the README with simple route definitions.
Includes commands such as api-key:generate for creating and managing API keys from the console, streamlining setup and administration.
The package is explicitly no longer maintained, with the author recommending Laravel's native features or Sanctum, posing risks for security and compatibility.
Focuses only on API key authentication, lacking support for modern methods like OAuth or JWT, which restricts its use in complex security scenarios.
Relies on third-party packages like Fractal and api-response, adding potential compatibility issues and learning overhead beyond core Laravel.