1. Go to this page and download the library: Download castle/castle-php 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/ */
castle / castle-php example snippets
Castle::setApiKey('YOUR_API_SECRET');
use Castle\Castle;
use Castle\Webhook;
use Castle\WebhookVerificationError;
Castle::setApiKey('YOUR_API_SECRET');
$verdict = Castle::filter([
'request_token' => $requestToken,
'name' => '$registration',
'user' => ['id' => '1234'],
]);
try {
Webhook::verify();
} catch (WebhookVerificationError $e) {
// reject the request
}
try {
Castle::risk([/* ... */]);
} catch (Castle_ApiError $e) {
// still catches the namespaced Castle\ApiError thrown by the library
}