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 1mo ago

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 54% of packages

Maintenance43

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

456d 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

[omniphx/forrest

A Laravel library for Salesforce

2724.4M8](/packages/omniphx-forrest)[sunchayn/nimbus

A Laravel package providing an in-browser API client with automatic schema generation, live validation, and built-in authentication with a touch of Laravel-tailored magic for effortless API testing.

29428.0k](/packages/sunchayn-nimbus)[muhammadhuzaifa/telescope-guzzle-watcher

Telescope Guzzle Watcher provide a custom watcher for intercepting http requests made via guzzlehttp/guzzle php library. The package uses the on\_stats request option for extracting the request/response data. The watcher intercept and log the request into the Laravel Telescope HTTP Client Watcher.

98239.8k1](/packages/muhammadhuzaifa-telescope-guzzle-watcher)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[pdphilip/cf-request

Cloudflare Laravel Request

2725.6k1](/packages/pdphilip-cf-request)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)

PHPackages © 2026

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