PHPackages                             missionx-co/laravel-prevent-duplicate-request - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. missionx-co/laravel-prevent-duplicate-request

AbandonedArchivedLibrary[HTTP &amp; Networking](/categories/http)

missionx-co/laravel-prevent-duplicate-request
=============================================

A Laravel package that prevents duplicate API requests using Idempotency keys or dynamically generated keys based on request URL and input.

0.1.4(1y ago)311MITPHPPHP ^8.3

Since Feb 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/missionx-co/laravel-prevent-duplicate-request)[ Packagist](https://packagist.org/packages/missionx-co/laravel-prevent-duplicate-request)[ Docs](https://github.com/missionx-co/laravel-prevent-duplicate-request)[ RSS](/packages/missionx-co-laravel-prevent-duplicate-request/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (6)Versions (6)Used By (0)

Laravel Prevent Duplicate Requests
==================================

[](#laravel-prevent-duplicate-requests)

[![Latest Version on Packagist](https://camo.githubusercontent.com/dfd9579f18b03ee8cd431a6a8e9d15ecf3f6ba306c3ba2ba36ab986219267cac/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d697373696f6e782d636f2f6c61726176656c2d70726576656e742d6475706c69636174652d726571756573742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/missionx-co/laravel-prevent-duplicate-request)[![Total Downloads](https://camo.githubusercontent.com/ebbae369906bf56a20a13a489bd41def30a372b3e693e906d34d4c00217b262e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d697373696f6e782d636f2f6c61726176656c2d70726576656e742d6475706c69636174652d726571756573742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/missionx-co/laravel-prevent-duplicate-request)

A Laravel package to prevent duplicate API requests using either Idempotency Keys or dynamically generated keys based on the request URL and input.

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require missionx-co/laravel-prevent-duplicate-request
```

### Publish the configuration file

[](#publish-the-configuration-file)

```
php artisan vendor:publish --tag="prevent-duplicate-request-config"
```

Usage
-----

[](#usage)

### Middleware Setup

[](#middleware-setup)

Add the `preventDuplicateRequests` middleware to your API middleware group

**Laravel 11**

```
// bootstrap/app.php
->withMiddleware(function (Middleware $middleware) {
    $middleware->api(append: [
        'preventDuplicateRequests'
    ]);
})
```

**Laravel 10**

```
// app/Http/Kernel.php
protected $middlewareGroups = [
    'web' => [
        // ...
    ],

    'api' => [
        // ...
        'preventDuplicateRequests',
    ],
];
```

### Key Generation Algorithms

[](#key-generation-algorithms)

To prevent duplicate API requests, you can choose between two algorithms:

1. **Idempotency Key**: Use `\MissionX\LaravelPreventDuplicateRequest\UniqueKeyAlgorithms\IdempotencyKey::class` to uniquely identify and deduplicate requests, ensuring the same key results in the same response. This requires the client to send an Idempotency-Key header with each request.
2. **Request Fingerprint**: Use `\MissionX\LaravelPreventDuplicateRequest\UniqueKeyAlgorithms\RequestFingerprintGenerator::class` to automatically generate a unique key based on the request URL and input. This is useful when you don't want to rely on the client to provide a key.

#### Configuring the Algorithm

[](#configuring-the-algorithm)

Set the desired key generation algorithm in the configuration file (`config/prevent-duplicate-request.php`):

```
return [
    'key_algorithm' => \MissionX\LaravelPreventDuplicateRequest\UniqueKeyAlgorithms\RequestFingerprintGenerator::class,
];
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance40

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

5

Last Release

507d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/aeb75f35979097845cce704062910a6a8c85bc0a7b49b081df7350a4f20023fc?d=identicon)[manssour.mohammed](/maintainers/manssour.mohammed)

---

Top Contributors

[![mohammedmanssour](https://avatars.githubusercontent.com/u/19733629?v=4)](https://github.com/mohammedmanssour "mohammedmanssour (7 commits)")

---

Tags

laravelMissionXlaravel-prevent-duplicate-request

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/missionx-co-laravel-prevent-duplicate-request/health.svg)

```
[![Health](https://phpackages.com/badges/missionx-co-laravel-prevent-duplicate-request/health.svg)](https://phpackages.com/packages/missionx-co-laravel-prevent-duplicate-request)
```

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k102.4M1.4k](/packages/spatie-laravel-permission)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M100](/packages/dedoc-scramble)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816333.6k3](/packages/defstudio-telegraph)[spatie/laravel-passkeys

Use passkeys in your Laravel app

471890.7k39](/packages/spatie-laravel-passkeys)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
