1. Go to this page and download the library: Download enovision/slim-captcha 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/ */
enovision / slim-captcha example snippets
use Illuminate\Database\Capsule\Manager as DB;
$settings_captcha = [
... all the other settings ...,
'callbackSave' => function ($captcha) {
DB::table('captcha')->insert([
'captcha_time' => $captcha['time'],
'ip_address' => $captcha['ip_address'],
'word' => $captcha['word']
]);
},
'callbackCleanUp' => function ($expiration) {
DB::table('captcha')
->where('captcha_time', '<', $expiration)
->delete();
},
'callbackValidate' => function ($word, $ip_address, $expiration) {
$count = DB::table('captcha')
->where('word', $word)
->where('ip_address', $ip_address)
->where('captcha_time', '>', $expiration)
->count();
return $count;
}
];
return $settings_captcha;