yeknava / laravel-idempotent
idempotent middleware for laravel
dev-main
2021-07-06 15:41 UTC
Requires
- php: >= 7.1
- ext-json: *
- illuminate/support: 5.5.*|5.6.*|5.7.*|5.8.*|6.*|7.*|8.*
Requires (Dev)
- fzaninotto/faker: ^1.4
- orchestra/testbench: ^5.0
- phpstan/phpstan: ^0.12
- phpunit/phpunit: 9.4.3
This package is not auto-updated.
Last update: 2025-05-08 08:57:08 UTC
README
Laravel Idempotent Package
Installation
Use the package manager composer to install laravel idempotent package.
composer require yeknava/laravel-idempotent
Usage
Run this command in your terminal:
php artisan vendor:publish
Then add this to your Kernel.php in app/Http folder.
protected $routeMiddleware = [ //... 'idempotent' => \Yeknava\Laravel-Idempotent\Idempotent::class, ];
then you can use this on your routes like this:
Route::middleware('idempotent')->post('/', function (Request $request) { return 'hi'; });
Config
<?php return [ 'expires_in' => 86400, //24h 'force' => true, //force idempotent key exists (it wont force on GET method anyway) 'skip_http_methods' => [ 'HEAD', 'OPTIONS', ], 'header_key' => 'Idempotency-Key' ];
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.