PHP code example of florentingarnier / spam-protection
1. Go to this page and download the library: Download florentingarnier/spam-protection 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/ */
florentingarnier / spam-protection example snippets
use FlorentinGarnier\SpamProtection\IpReputation\IpReputation;
use FlorentinGarnier\SpamProtection\IpReputation\IpReputationList;
use FlorentinGarnier\SpamProtection\SpamProtection;
$spamProtection = SpamProtection::create(
secret: $appSecret, // long random string, signs the tokens
cache: $cachePool, // any PSR-6 pool
ipReputation: new IpReputation(new IpReputationList(__DIR__.'/var/ip_reputation.php')),
baseDifficulty: 10, // optional
maximumAttemptsPerHour: 20, // optional
tokenLock: $tokenLock, // recommended, see below
);