Repository navigation
First release of IdempotencyGuardBundle, adding opt-in idempotency keys and response replay to Symfony APIs.
Included
#[Idempotent]controller-method attribute with an optional TTL.- Required, validated operation keys and principal/origin-scoped request identity.
- JSON normalization that preserves array order, types, and numeric precision.
- Completed response replay and 409 conflicts for changed input or an in-flight operation.
- Replaceable storage abstraction with a PSR-6 cache adapter and absolute expiration.
- Single-host concurrency protection using Symfony Lock and FlockStore.
- Restricted response headers, bounded buffered bodies, predictable errors, and privacy-conscious infrastructure logs.
Requirements and validation
PHP 8.1+, Symfony 6.4, and a local filesystem supporting flock.
Validated with 131 tests / 300 assertions, PHPStan level 8, strict Composer validation, and dependency auditing. CI covers PHP 8.1?8.5, Windows PHP 8.1, and security-aware lowest dependencies. The package has also been installed and booted in a clean Symfony consumer without development dependencies.
Installation
Packagist registration is a separate step. Until it is indexed, install this GitHub release directly:
composer config repositories.idempotency-guard vcs https://github.com/hannhm1109/IdempotencyGuardBundle.git
composer require "hanane/idempotency-guard-bundle:~0.1.0"Use a regular runtime dependency so protection is present in production. Follow the README for bundle registration and configuration.
Operational scope
The default is single-host coordination and supported buffered 2xx responses up to 1 MiB. Business commits and response-record persistence are separate operations; cache loss, expiry, eviction, or a crash can permit another execution. Keep business uniqueness/provider safeguards where needed. See the security policy and changelog.
MIT licensed.