PHP code example of dskripchenko / yandex-smart-captcha

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

    

dskripchenko / yandex-smart-captcha example snippets


public function rules(): array
{
    return [
        'token' => 'yandex_smart_captcha',
    ];
}

use Dskripchenko\YandexSmartCaptcha\Facades\YandexSmartCaptcha;

$valid = YandexSmartCaptcha::validate(
    token: $request->input('token'),
    ip: $request->ip(),   // null skips the address check
    throwable: true,      // throw on failure instead of returning false
);
bash
php artisan vendor:publish --provider="Dskripchenko\YandexSmartCaptcha\Providers\YandexSmartCaptchaServiceProvider"