quillphp/key-auth

API Key authentication middleware for the Quill PHP framework

Maintainers

Package info

github.com/quillphp/quill-key-auth

pkg:composer/quillphp/key-auth

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-04-06 10:03 UTC

This package is auto-updated.

Last update: 2026-04-06 11:57:04 UTC


README

High-speed API Key authentication middleware for the Quill PHP Framework.

Installation

composer require quillphp/key-auth

Usage

use Quill\KeyAuth\KeyAuth;

$app->use(KeyAuth::new([
    'keys'   => ['secret-api-key-1', 'secret-api-key-2'],
    'header' => 'X-API-Key',
]));

Configuration

Option Default Description
`query` `'api_key'` The URL query parameter to check.
`keys` `[]` An array of valid API keys.
`validator` `null` Custom validator closure: `fn(string $key) => bool`.
`error_code` `401` The error code to return for unauthorized requests.
`error_message` `'Unauthorized: Invalid or missing API Key'` The error message to return.

License

MIT