1. Go to this page and download the library: Download jamescarr/ankusa 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/ */
jamescarr / ankusa example snippets
use Ankusa\ClaimCheck\ClaimCheckClient;
use Ankusa\ClaimCheck\ClaimCheckError;
$claimCheck = new ClaimCheckClient(getenv('CLAIM_CHECK_URL') ?: 'http://localhost:4001');
// A queue message that carries a claim also carries its sha256:
// "claim": "urn:ankusa:claim:v1:<tenant>:<claim_id>" (claim_id: uppercase ULID)
// "sha256": 64-char lowercase hex of the claim's bytes
function resolveBody(ClaimCheckClient $claimCheck, array $message): string
{
try {
return $claimCheck->redeem($message['claim'], $message['sha256']);
} catch (ClaimCheckError $err) {
if (! $err->isRetryable()) {
// bad ref/sha256, 404, or an integrity mismatch: dead-letter, don't requeue
throw $err;
}
// gateway unreachable or 5xx: safe to retry
throw $err;
}
}