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

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

    

alexleonnovak / yii2-module-recaptcha-v3 example snippets


'components' => [
    ...
    'reCaptcha3' => [
        'class'      => 'alexleonnovak\recaptcha3\ReCaptcha',
        'site_key'   => 'site_key_###',
        'secret_key' => 'secret_key_###',
    ],


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

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

defined('YII_ENV') or define('YII_ENV', 'test');

php composer.phar 
index-test.php