1. Go to this page and download the library: Download jkphl/antibot 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/ */
jkphl / antibot example snippets
use Jkphl\Antibot\Ports\Antibot;
use Jkphl\Antibot\Ports\Validators\HmacValidator;
use Jkphl\Antibot\Ports\Validators\HoneypotValidator;
use Jkphl\Antibot\Ports\Validators\ParameterPlausibilityValidator;
$antibot = new Antibot($sessionId, 'contact-form');
$antibot->setSecret($installationSecret);
$antibot->addValidator(new HoneypotValidator(['email' => 'email', 'url' => 'url']));
$hmac = new HmacValidator();
$hmac->setMethodVector(HmacValidator::METHOD_GET, HmacValidator::METHOD_POST);
$hmac->setSubmissionTimes(3600, 3, 1);
$antibot->addValidator($hmac);
$antibot->addValidator(new ParameterPlausibilityValidator([
'message' => ['minWords' => 5, 'maxLength' => 5000],
]));
// When rendering the form
echo $antibot->armor($request);
// When a submission arrives
$result = $antibot->validate($request);
if (!$result->isValid()) {
// Refused — $result->getErrors() says why
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.