Looking to hire Laravel developers? Try LaraJobs
This package is not available.

laravel-idempotent maintained by yeknava

Description
idempotent middleware for laravel
Author
Last update
2021/07/06 17:41 (dev-main)
License
Links
Downloads
0

Comments
comments powered by Disqus

Laravel Idempotent Package

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.

License

MIT