Replay - Idempotency Middleware package makes your endpoints idempotent easily. Add support idempotency requests to your APIs easily by adding a middleware.
Record and replay only successful(2xx) and server-side errors(5xx) responses, without touching your controller again.
The Bvtterfly\Replay\Replay-middleware must be registered in the kernel: //app/Http/Kernel.php protected $routeMiddleware = [ ... 'replay' => \Bvtterfly\Replay\Replay, ]; Next, For idempotent an endpoint, apply replay middleware to it: Route::post('/payments', function () { // })->middleware('replay'); Custom Policy
If Replay can't find the key, it attempts to acquire a cache lock and caches successful or server error responses.