quillphp/idempotency

Idempotency middleware for the Quill PHP framework

Maintainers

Package info

github.com/quillphp/quill-idempotency

pkg:composer/quillphp/idempotency

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

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

This package is auto-updated.

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


README

Idempotency middleware for the Quill PHP Framework. Prevents duplicate API operations by caching successful responses based on a client-provided key.

Installation

composer require quillphp/idempotency

Usage

use Quill\Idempotency\Idempotency;
use Quill\Storage\RedisStorage;

$app->use(Idempotency::new([
    'storage' => new RedisStorage(['host' => '127.0.0.1']),
    'header'  => 'X-Idempotency-Key',
    'ttl' => 86400, // 24 hours
]));

Configuration

Option Default Description
`storage` `null` Required. Any `StorageInterface` instance (Redis, APCu, etc.).
`header` `'X-Idempotency-Key'` The HTTP header containing the idempotency key.
`ttl` `86400` How long to cache response (in seconds).
`methods` `['POST', 'PATCH', 'PUT']` HTTP methods to enforce idempotency on.
`cached_header` `'X-Idempotency-Cached'` The header added to cached responses.

License

MIT