PHP code example of z1bun / yii2-module-recaptcha-v3

1. Go to this page and download the library: Download z1bun/yii2-module-recaptcha-v3 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/ */

    

z1bun / yii2-module-recaptcha-v3 example snippets


'components' => [
    ...
    'reCaptcha3' => [
        'class'      => 'z1bun\recaptcha3\ReCaptcha',
        'siteKey' => env('recaptcha_site_key'),
        'secretKey' => env('recaptcha_secret_key'),
    ],


public $reCaptcha;
 
public function rules()
{
 	return [
 		...
 		 [['reCaptcha'], \z1bun\recaptcha3\ReCaptchaValidator::class, 'acceptance_score' => 0]
 	];
}

<?= $form->field($model, 'reCaptcha')->widget(\z1bun\recaptcha3\ReCaptchaWidget::class) 

defined('YII_ENV') or define('YII_ENV', 'test');
index-test.php