PHP code example of mj-zana / idempotency
1. Go to this page and download the library: Download mj-zana/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/ */
mj-zana / idempotency example snippets
#[Route('/api/orders/{id}/pay', methods: ['POST'], middleware: [IdempotencyMiddleware::class])]
#[Idempotent(
// config/idempotency.php
return [
'ttl' => 86400, // seconds a key and its response are kept
'lock_seconds' => 60, // how long a running request holds its key
];
php bin/zana idempotency:install
php bin/zana migrate
php bin/zana idempotency:prune