PHP code example of kvnc / spam-shield

1. Go to this page and download the library: Download kvnc/spam-shield 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/ */

    

kvnc / spam-shield example snippets


'recaptcha' => [
    'enabled' => true,
    'site_key' => env('RECAPTCHA_SITE_KEY', 'your-site-key'),
    'secret_key' => env('RECAPTCHA_SECRET_KEY', 'your-secret-key'),
],

RECAPTCHA_SITE_KEY=your-site-key
RECAPTCHA_SECRET_KEY=your-secret-key

'timeout' => [
    'enabled' => true,
    'minimum_seconds' => 3, // Minimum time (in seconds) between form load and submission
],

'honeypot' => [
    'enabled' => true,
    'field_name' => 'hidden_field', // Name of the honeypot field
],

'random_questions' => [
    'enabled' => true,
    'questions' => [
        'en' => [
            'What is 2 + 2?' => '4',
            'What is the capital of France?' => 'Paris',
            'What color is the sky on a clear day?' => 'blue',
        ],
        'tr' => [
            '2 + 2 kaç eder?' => '4',
            'Türkiye’nin başkenti neresidir?' => 'Ankara',
            'Gökyüzü açık bir günde ne renktir?' => 'mavi',
        ],
    ],
],

'anti-spam' => \AntiSpam\Middleware\AntiSpamMiddleware::class,

Route::post('/submit', 'FormController@submit')->middleware('anti-spam');

'questions' => [
    'en' => [
        'What is the square root of 16?' => '4',
        'What is the capital of Germany?' => 'Berlin',
    ],
    'tr' => [
        '16’nın karekökü nedir?' => '4',
        'Almanya’nın başkenti neresidir?' => 'Berlin',
    ],
],
bash
php artisan vendor:publish --tag=config --provider="AntiSpam\AntiSpamServiceProvider"