バハ2オデフ/yii2-recaptcha-v3

Yii2 reCAPTCHA v3

安装次数: 40,070

依赖关系: 0

建议者: 0

安全: 0

星标: 3

关注者: 2

分支: 14

公开问题: 5

类型:yii2-extension

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

This package is auto-updated.

Last update: 2024-09-20 23:54:10 UTC


README

Yii2 reCAPTCHA v3

安装

安装此扩展的首选方式是通过 composer

执行以下操作之一

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

或者添加

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

到您的 composer.json 文件的 require 部分。

使用方法

扩展安装後,只需在代码中使用即可

将其添加到 components/main.php

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

并在您的模型中

acceptance_score 此请求的最小分数(0.0 - 1.0)或 null

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