Download the PHP package ademakanaky/laravel-enterprise-idempotency without Composer

On this page you can find all versions of the php package ademakanaky/laravel-enterprise-idempotency. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-enterprise-idempotency

Laravel Enterprise Idempotency

Laravel PHP License Tests

Enterprise-grade Idempotency Middleware for Laravel APIs

This package prevents duplicate request processing and safely replays the original response when a client retries a request using the same Idempotency-Key.

It is designed for financial systems, payment APIs, fintech platforms, loan services, and mission‑critical backend systems where duplicate processing must be prevented.


Table of Contents


Features


Installation

Install the package via Composer:

Publish the configuration:

Publish the migration:

Run migrations:


Basic Usage

Apply the middleware to routes that require idempotency protection.

Clients must include an Idempotency-Key header.

Example request:

POST /payments
Idempotency-Key: PAY-123456789

How Idempotency Works

First Request

Client sends request:

Idempotency-Key: abc123
  1. The request is processed normally.
  2. The response is stored.
  3. The idempotency key is recorded.

Retry Request

Client retries using the same key:

Idempotency-Key: abc123

Instead of executing the request again:

Response header:

Idempotency-Replayed: true

Drivers

Driver configuration is located at:

config/idempotency.php

Cache Driver

Uses Laravel cache to store responses.

Best for:


Database Driver

Stores request and response data in the database.

Best for:


Hybrid Driver (Recommended)

Uses:

Benefits:


Configuration

Example configuration file:


Request Hash Protection

Requests are hashed using:

HTTP Method + Route + Request Body

If the same Idempotency-Key is reused with different request data, the request will fail.

Example response:

409 Conflict
Idempotency key conflict

This ensures request integrity.


Automatic User Scoping

Idempotency keys are automatically scoped to avoid collisions.

Priority:

  1. Authenticated User ID
  2. Client IP Address

This prevents two different users from accidentally sharing the same idempotency key.


Response Replay

When a stored response is returned, the API includes the header:

Idempotency-Replayed: true

This allows API clients to detect that a response came from a retry.


Example Payment Flow

Initial Request

POST /payments
Idempotency-Key: PAY-001

A network failure occurs before the client receives the response.

Client Retry

POST /payments
Idempotency-Key: PAY-001

Instead of creating a second payment, the API returns the original stored response.


Architecture Overview

Client
  |
  |  POST /payments
  |  Idempotency-Key
  v
Idempotency Middleware
  |
  |-- Check existing key
  |-- Validate request hash
  |-- Acquire lock (Hybrid)
  |
  v
Application Controller
  |
  v
Response Stored
  |
  v
Future retries replay stored response

Testing

Run the full test suite:

Test coverage includes:


Package Structure

laravel-idempotency
│
├── src
│   ├── Contracts
│   │   └── IdempotencyDriver.php
│   │
│   ├── Drivers
│   │   ├── CacheDriver.php
│   │   ├── DatabaseDriver.php
│   │   └── HybridDriver.php
│   │
│   ├── Http
│   │   └── Middleware
│   │       └── IdempotencyMiddleware.php
│   │
│   ├── Models
│   │   └── IdempotencyRecord.php
│   │
│   ├── Providers
│   │   └── IdempotencyServiceProvider.php
│   │
│   └── Services
│       └── IdempotencyManager.php
│
├── config
│   └── idempotency.php
│
├── database
│   └── migrations
│
├── tests
│   ├── Feature
│   └── Unit
│
├── composer.json
└── phpunit.xml

Security Considerations

This package ensures:

Recommended for:


Example Idempotency Key Generation

Clients should generate unique idempotency keys.

Example in Laravel:

Example request header:

Idempotency-Key: PAY-550e8400-e29b-41d4-a716-446655440000

Contributing

Pull requests are welcome.

Please ensure all tests pass before submitting:


TO-DO:

License

MIT License


All versions of laravel-enterprise-idempotency with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/support Version ^10.0|^11.0
illuminate/http Version ^10.0|^11.0
illuminate/database Version ^10.0|^11.0
illuminate/cache Version ^10.0|^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ademakanaky/laravel-enterprise-idempotency contains the following files

Loading the files please wait ...