1. Go to this page and download the library: Download datadome/fraud-sdk-symfony 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/ */
datadome / fraud-sdk-symfony example snippets
use DataDome\FraudSdkSymfony\Config\DataDomeOptions;
use DataDome\FraudSdkSymfony\DataDome;
use DataDome\FraudSdkSymfony\Models\Address;
use DataDome\FraudSdkSymfony\Models\LoginEvent;
use DataDome\FraudSdkSymfony\Models\StatusType;
use DataDome\FraudSdkSymfony\Models\RegistrationEvent;
use DataDome\FraudSdkSymfony\Models\Session;
use DataDome\FraudSdkSymfony\Models\User;
use DataDome\FraudSdkSymfony\Models\ResponseAction;
$key = $_ENV['DATADOME_FRAUD_API_KEY'];
$timeout = $_ENV['DATADOME_TIMEOUT'];
$endpoint = $_ENV['DATADOME_ENDPOINT'];
$options = new DataDomeOptions($key, $timeout, $endpoint);
$this->dataDome = new DataDome($options);
if ($this->validateLogin("account_guid_to_check")) {
$loginEvent = new LoginEvent("account_guid_to_check", StatusType::Succeeded);
$loginResponse = $this->dataDome->validate($request, $loginEvent);
if ($loginResponse != null && $loginResponse->action == ResponseAction::Allow->jsonSerialize()) {
// Valid login attempt
return new JsonResponse([true]);
} else {
// Business Logic here
// MFA
// Challenge
// Notification email
// Temporarily lock account
return new JsonResponse(["Login denied"]);
}
}
else {
$loginEvent = new LoginEvent("account_guid_to_check", StatusType::Failed);
$this->dataDome->collect($request, $loginEvent);
}
composer dump-autoload
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.