Laravel Packages

Safely Retry API calls in Laravel

Published
Safely Retry API calls in Laravel image

Idempotency for Laravel is a production-ready package for implementing idempotency in API requests. Clients can safely retry API calls using this package without worrying about duplicate processing.

Using the Idempotency-Key header with a unique UUID, you can send the same key over and over, and the original response is returned without running an operation multiple times:

POST /api/payments HTTP/1.1
Content-Type: application/json
Idempotency-Key: 123e4567-e89b-12d3-a456-426614174000
 
{
"amount": 1000,
"currency": "USD",
"description": "Order #1234"
}

When using this package, API responses include an Idempotency-Key that API users safely use in the future to re-run the operation.

Main Features

  • Robust Cache Mechanism: Reliably stores and serves cached responses
  • Lock-Based Concurrency Control: Prevents race conditions with distributed locks
  • Comprehensive Telemetry: Track and monitor idempotency operations
  • Alert System: Get notified about suspicious activity
  • Payload Validation: Detect when the same key is used with different payloads
  • Detailed Logging: Easily debug idempotency issues

You can learn more about this package, get full installation instructions, and view the source code on GitHub. You can install this package via Composer:

composer require infinitypaul/idempotency-laravel
php artisan vendor:publish --provider="Infinitypaul\Idempotency\IdempotencyServiceProvider"
Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Sponsored

laravelcloud logo
Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Visit Laravel Cloud

The latest

View all →
Image Dominant Color and HEIC Support in Laravel 13.24 image

Image Dominant Color and HEIC Support in Laravel 13.24

Read article
Official Laravel Zed Extension: LSP for PHP & Blade image

Official Laravel Zed Extension: LSP for PHP & Blade

Read article
Laravel Head: Manage Meta Tags, Open Graph, and JSON-LD image

Laravel Head: Manage Meta Tags, Open Graph, and JSON-LD

Read article
PhpStorm 2026.2 Released image

PhpStorm 2026.2 Released

Read article
Laravel Doctor: Diagnose Your App With One Artisan Command image

Laravel Doctor: Diagnose Your App With One Artisan Command

Read article
CPX: The Composer Package Executor for PHP image

CPX: The Composer Package Executor for PHP

Read article