1. Go to this page and download the library: Download redeyed/sdk 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/ */
redeyed / sdk example snippets
use Redeyed\Client;
use Redeyed\RedeyedException;
// A developer API key is .
$redeyed = new Client(getenv('REDEYED_API_KEY'), [
'secret_key' => getenv('SENTINEL_SECRET_KEY'), // your site's Sentinel Secret Key
]);
try {
$me = $redeyed->me(); // account + remaining quota
$rep = $redeyed->ip('8.8.8.8'); // IP reputation (omit arg = caller)
// Server-side captcha check. Pass the token from the widget (rendered with
// your public Site Key). The visitor's IP is auto-detected (proxy-aware) and
// sent as `remoteip`; pass a second argument to override. Passes when
// $result['success'] === true.
$result = $redeyed->verify($tokenFromWidget);
if (! $result['success']) {
// reject the submission — outcome: $result['outcome'], score: $result['score']
}
$chat = $redeyed->aiChat(['messages' => [['role' => 'user', 'content' => 'Three taglines, please.']]]);
$para = $redeyed->aiParaphrase(['text' => 'Make this confident.']);
$img = $redeyed->aiImage(['prompt' => 'a neon fox, cinematic']);
} catch (RedeyedException $e) {
// $e->errorCode (e.g. insufficient_scope), $e->status (e.g. 403), $e->getMessage()
}
// One-time: create a key (symmetric for encrypt/decrypt, or 'signing' for Ed25519).
$redeyed->kmsCreateKey('orders', 'symmetric');
// Encrypt a small secret. Optional $aad is bound into the ciphertext and must
// match on decrypt — great for tying a value to a record id.
$enc = $redeyed->kmsEncrypt('orders', '4111 1111 1111 1111', 'order:8842');
$ciphertext = $enc['ciphertext'];
// Decrypt (returns plaintext_b64, plus plaintext when valid UTF-8).
$dec = $redeyed->kmsDecrypt('orders', $ciphertext, 'order:8842');
echo $dec['plaintext'];
// Envelope encryption for large data: get a data key, encrypt locally, store the
// wrapped key beside your data, then unwrap it when you need to read.
$dk = $redeyed->kmsDataKey('orders'); // ['plaintext_key_b64' => ..., 'wrapped_key' => ...]
$plainKey = $redeyed->kmsDecryptDataKey('orders', $dk['wrapped_key'])['plaintext_key_b64'];
// Signing keys (Ed25519):
$sig = $redeyed->kmsSign('webhooks', $payload)['signature'];
$ok = $redeyed->kmsVerify('webhooks', $payload, $sig)['valid'];