High-speed API Key authentication middleware for the Quill PHP Framework.
composer require quillphp/key-authuse Quill\KeyAuth\KeyAuth;
$app->use(KeyAuth::new([
'keys' => ['secret-api-key-1', 'secret-api-key-2'],
'header' => 'X-API-Key',
]));| 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. |
MIT