baha2odeh/yii2-recaptcha-v3

Yii2 reCAPTCHA v3

Installs: 34 164

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 2

Forks: 14

Open Issues: 5

Type:yii2-extension

v1.2 2019-06-20 12:29 UTC

This package is auto-updated.

Last update: 2024-04-20 23:02:07 UTC


README

Yii2 reCAPTCHA v3

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist baha2odeh/yii2-recaptcha-v3 "*"

or add

"baha2odeh/yii2-recaptcha-v3": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

add this to your components main.php

'components' => [
        ...
        'recaptchaV3' => [
            'class' => 'Baha2Odeh\RecaptchaV3\RecaptchaV3',
            'site_key' => '###',
            'secret_key' => '###',
            'verify_ssl' => true, // default is true
        ],

and in your model

acceptance_score the minimum score for this request (0.0 - 1.0) or null

public $code;
 
 public function rules(){
 	return [
 		...
 		 [['code'], RecaptchaV3Validator::className(), 'acceptance_score' => null]
 	];
    }
   <?= $form->field($model,'code')->widget(\Baha2Odeh\RecaptchaV3\RecaptchaV3Widget::className()); ?>