PHP code example of felipetti / captcha

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

    

felipetti / captcha example snippets


/*
    |--------------------------------------------------------------------------
    | Secret Key
    |--------------------------------------------------------------------------
    |
    | This is the Captcha key that only back-end has.
    |
    */

    'secret_key' => ''

    use Felipetti\Captcha\Rule\CaptchaVerification;
    
    public function rules()
    {
        $captcha = ['

use Felipetti\Captcha\Rule\CaptchaVerification;
use Illuminate\Http\Request;

class CaptchaController extends Controller
{
    public function __invoke(Request $request)
    {
        $request->validate(
            ['captcha' => [new CaptchaVerification]]
        );

        //...
    }
}

use Felipetti\Captcha\Rule\CaptchaVerification;
use Illuminate\Support\Facades\Validator;
use Illuminate\Http\Request;

class CaptchaController extends Controller
{
    public function __invoke(Request $request)
    {
        $rules  = ['captcha' => [new CaptchaVerification]];

        Validator::make($request->only('captcha'), $rules)->validate();

        //...
    }
}
bash
php artisan vendor:publish --tag=captcha