bariew/yii2-invisible-recaptcha
最新稳定版本:0.0.3
Composer 安装命令:
composer require bariew/yii2-invisible-recaptcha
包简介
Validates form post with Goolge Invisible Recaptcha
README 文档
README
Validates your ActiveForm using Google invisible-recaptcha
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist bariew/yii2-invisible-recaptcha "*"
or add
"bariew/yii2-invisible-recaptcha": "*"
to the require section of your composer.json file.
Usage
- Set application config params:
'params' => [
...
'invisible-recaptcha-key' => '<Your Key>',
'invisible-recaptcha-secret' => '<Your Secret>'
]
- Add verification attribute and a validation rule into your model rules:
public $verifyCode;
/**
* @inheritdoc
*/
public function rules()
{
return [
...
['verifyCode', InvisibleRecaptchaValidator::className(), 'message' => 'Invalid captcha value'],
];
}
- Use widget instead of ActiveForm submit button in your view:
<?= $form->field($model, 'verifyCode')->widget(\bariew\invisibleRecaptcha\InvisibleRecaptchaWidget::className(), [
'buttonText' => 'Save' ,
'options' => ['class' => 'btn btn-primary'],
]); ?>
统计信息
- 总下载量: 16.35k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2018-03-27