PHPackages                             lidongyooo/laravel-idempotent - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. lidongyooo/laravel-idempotent

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

lidongyooo/laravel-idempotent
=============================

laravel idempotent

1.0.1(4y ago)132.2kMITPHPPHP &gt;=7.0.0

Since Jul 5Pushed 4y ago1 watchersCompare

[ Source](https://github.com/lidongyooo/Laravel-Idempotent)[ Packagist](https://packagist.org/packages/lidongyooo/laravel-idempotent)[ RSS](/packages/lidongyooo-laravel-idempotent/feed)WikiDiscussions main Synced yesterday

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

Laravel-Idempotent
------------------

[](#laravel-idempotent)

基于 [Laravel](https://github.com/laravel/laravel) 的接口幂等组件

安装
--

[](#安装)

```
$ composer require lidongyooo/laravel-idempotent -vvv

```

配置
--

[](#配置)

1. 在 `config/app.php` 注册 ServiceProvider (Laravel 5.5 + 无需手动注册)

```
'providers' => [
    // ...
    Lidongyooo\Idempotent\IdempotentServiceProvider::class,
],
```

2. 创建配置文件

```
$ php artisan vendor:publish --tag="laravel-idempotent"

```

3. 查看应用根目录下的 `config/idempotent.php`

使用
--

[](#使用)

中间件 `Lidongyooo\Idempotent\IdempotentMiddleware`，别名 `idempotent`

```
// ...
Route::post('/test', function () {
    return 'test';
})->middleware('idempotent');

//如果你想强制缓存响应
Route::post('/test', function () {
    return 'test';
})->middleware('idempotent:true');
```

或者你可以将它加入到指定路由中间件组中

```
protected $middlewareGroups = [
    // ...
    'api' => [
        'idempotent',
        'throttle:api',
        \Illuminate\Routing\Middleware\SubstituteBindings::class,
    ],
];
```

返回值
---

[](#返回值)

- 重复请求将会返回异常

```
abort(425, 'Your request is still being processed.');
```

- 已缓存的请求将添加响应头

```
$response->header($this->config['back_header_name'], $idempotentKey);
```

更多详细介绍请查看 [配置文件](https://github.com/lidongyooo/Laravel-Idempotent/blob/main/config/idempotent.php)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

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 ~0 days

Total

2

Last Release

1772d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3eabf1afb9cf5cba76592a94ff41fb52da07dcf1f91e9a91b04dcc17a95fa7ba?d=identicon)[lidongyooo](/maintainers/lidongyooo)

---

Top Contributors

[![lidongyooo](https://avatars.githubusercontent.com/u/49540545?v=4)](https://github.com/lidongyooo "lidongyooo (15 commits)")

---

Tags

laravellaravel-packagephplaravelidempotent

### Embed Badge

![Health badge](/badges/lidongyooo-laravel-idempotent/health.svg)

```
[![Health](https://phpackages.com/badges/lidongyooo-laravel-idempotent/health.svg)](https://phpackages.com/packages/lidongyooo-laravel-idempotent)
```

###  Alternatives

[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[gehrisandro/tailwind-merge-laravel

TailwindMerge for Laravel merges multiple Tailwind CSS classes by automatically resolving conflicts between them

341682.2k18](/packages/gehrisandro-tailwind-merge-laravel)[nickurt/laravel-akismet

Akismet for Laravel 11.x/12.x/13.x

97139.6k2](/packages/nickurt-laravel-akismet)[whitecube/laravel-timezones

Store UTC dates in the database and work with custom timezones in the application.

106106.2k](/packages/whitecube-laravel-timezones)[sbine/route-viewer

A Laravel Nova tool to view your registered routes.

57215.9k](/packages/sbine-route-viewer)[forxer/laravel-gravatar

A library providing easy gravatar integration in a Laravel project.

4235.6k](/packages/forxer-laravel-gravatar)

PHPackages © 2026

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