bluebeetle / idempotency-middleware
Idempotency middleware for your Laravel API.
Package info
github.com/bluebeetlept/idempotency-middleware
pkg:composer/bluebeetle/idempotency-middleware
v1.0.0
2026-05-02 18:12 UTC
Requires
- php: ^8.4
- illuminate/cache: ^12.0|^13.0
- illuminate/contracts: ^12.0|^13.0
- illuminate/http: ^12.0|^13.0
- illuminate/support: ^12.0|^13.0
- nesbot/carbon: ^3.9
- ramsey/uuid: ^4.8
- symfony/http-foundation: ^7.3|^8.0
Requires (Dev)
- eufaturo/coding-standards: dev-main
- orchestra/testbench: ^11.0
- phpunit/phpunit: ^13.0
README
Simple and fully tested Laravel middleware for implementing idempotency in your API requests.
Quick Start
composer require bluebeetle/idempotency-middleware
Add the middleware to your routes:
use BlueBeetle\IdempotencyMiddleware\Idempotency; Route::middleware([Idempotency::class])->group(function () { Route::post('/orders', [OrderController::class, 'store']); });
Send requests with an Idempotency-Key header (UUID v4):
POST /api/orders HTTP/1.1
Idempotency-Key: 6b3fd36c-24c6-4eb2-a764-bb6c91b33e56
Content-Type: application/json
{"product_id": 1, "quantity": 2}
Repeated requests with the same key return the cached response instead of processing again.
Documentation
Full documentation is available at bluebeetle.pt/open-source/docs/idempotency-middleware/v1.
Testing
composer test
Credits
License
Licensed under the MIT license.