Skip to content
Nav

Using with Access Guard

composer require langsys/laravel-api-keys
Packagist version Monthly downloads License PHP 8.2+ Laravel 10 / 11 / 12

Install both and your API keys become first-class authorization subjects with no glue code. Access Guard detects this package and adapts its ApiKey automatically — checking the key’s permissions and whether it’s linked to the entity being accessed. You link keys to entities on the Access Guard side ($entity->grantApiKey($key)); no subclassing or contracts required here.

If your application already links keys to entities through its own pivot, the other supported path is to implement Access Guard’s AuthorizableByKey contract on your own key subclass and set Access Guard’s bridge => null. Auto-detection then stays out of the way and your existing relations keep being used.

Feedback