定制 boone-studios/laravel-idempotency 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

boone-studios/laravel-idempotency

Composer 安装命令:

composer require boone-studios/laravel-idempotency

包简介

Stripe-style Idempotency-Key middleware for multi-tenant Laravel APIs.

README 文档

README

License: MIT Used by Forgebit

Stripe-style Idempotency-Key middleware for multi-tenant Laravel APIs.

  • Requires an idempotency header on mutating requests
  • Cache-locks concurrent retries
  • Replays the stored response on matching payload
  • Returns 409 Conflict when the same key is reused with a different body
  • Prunes expired records via Eloquent's Prunable

Requirements

  • PHP 8.2+
  • Laravel 12 or 13

Installation

composer require boone-studios/laravel-idempotency
php artisan vendor:publish --tag=idempotency-config
php artisan vendor:publish --tag=idempotency-migrations
php artisan migrate

Configuration

scope_resolver must be configured before you use this middleware. There is no default implementation — the package ships as null and will throw a RuntimeException at request time (with a message pointing back to this config key) if you register the idempotency middleware on a route without setting it first.

Implement BooneStudios\Idempotency\Contracts\ResolvesIdempotencyScope and set it in config/idempotency.php:

'scope_resolver' => App\Services\TenantContext::class,
'scope_column' => 'tenant_id', // or vendor_id, organization_id, …

Register the middleware:

Route::middleware('idempotency')->post('/orders', …);

Only apply the idempotency middleware to routes where a scope/tenant is always resolvable (e.g. authenticated, tenant-scoped endpoints). Routes that legitimately have no tenant yet (e.g. a signup endpoint) should not use this middleware — resolution failure is treated as a configuration error, not a "no tenant" case.

License

MIT © Boone Studios, LLC

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固