PHP code example of algoyounes / idempotency

1. Go to this page and download the library: Download algoyounes/idempotency library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

algoyounes / idempotency example snippets


Route::middleware('idempotency')->post('/orders', 'OrderController@store');

Route::middleware('idempotency')->group(function () {
    Route::post('/orders', 'OrderController@store');
    Route::get('/orders/{id}', 'OrderController@show');
});

use AlgoYounes\Idempotency\Contracts\Resolver;

class CustomUserIdResolver implements Resolver
{
    public function resolve(): string
    {
        // Your custom logic here
    }
}

// In the configuration file
'user_id_resolver' => CustomUserIdResolver::class,
bash
php artisan vendor:publish --provider="AlgoYounes\Idempotency\Providers\IdempotencyServiceProvider" --tag="config"