Repository navigation
v6.0.0
The first release of Laravel API Idempotency, on the Laravel 6 line: opt-in HTTP idempotency for Laravel routes, with fail-closed recovery.
What's included
- One route macro:
Route::post(...)->idempotent(), also onRoute::resource()andapiResource(), and theidempotentmiddleware alias with an optional ttl. Routes stay compatible withroute:cache. - The
Idempotency-Keycontract: keys of 1 to 255 visible ASCII characters, scoped per principal through aScopeResolver(the authenticated user by default), with request fingerprints of the method, path, query string and JSON body throughpharaonic/php-fingerprint. - Atomic reservation in the database (a unique insert, with a publishable migration) or Redis (Lua scripts, phpredis and predis).
- Exact replay of
2xxJSON or empty responses with their safe headers andIdempotency-Replayed: true; other4xxresponses release the key. - Fail closed: server errors, exceptions, unstorable responses, abandoned leases and store outages never lead to a second run. Refused requests throw
IdempotencyExceptionwith a stable error code. IdempotentRequestReserved,IdempotentRequestReplayed,IdempotentRequestRejectedandIdempotentRequestUnresolvedevents, and theidempotency:prunecommand. Logs never carry the client's key, the user or the body.
Requirements
| 6.0.0 | |
|---|---|
| PHP | 8.0 |
| Laravel | 6.20+ |
Full Changelog: https://github.com/Pharaonic/laravel-api-idempotency/commits/6.0.0