PHP code example of cotiga / spam-guard-lr10

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

    

cotiga / spam-guard-lr10 example snippets




namespace App\Exceptions;

use Cotiga\SpamGuard\Exceptions\SpamGuardHandler;
use Throwable;

class Handler extends SpamGuardHandler
{
    protected $dontFlash = [
        'current_password',
        'password',
        'password_confirmation',
    ];

    public function register(): void
    {
        $this->reportable(function (Throwable $e) {
            //
        });
    }
}

use Cotiga\SpamGuard\Services\FormSpamGuard;

class ContactController extends Controller
{
    public function store(ContactRequest $request, FormSpamGuard $guard)
    {
        if ($guard->isSpam($request->mel, $request->ip(), $request->only(['nom', 'tel', 'msg']))) {
            return $this->fakeSuccessResponse($request);
        }
        // traitement normal...
    }
}
bash
php artisan vendor:publish --tag=spam-guard-config
bash
php artisan vendor:publish --tag=spam-guard-views