demi/recaptcha
最新稳定版本:1.0.1
Composer 安装命令:
composer require demi/recaptcha
包简介
Yii2 wrapper for reCAPTCHA widget
README 文档
README
Yii2 wrapper for [reCAPTCHA](https://www.google.com/recaptcha/intro/index.html widget)
Installation
Run
composer require "demi/recaptcha" "~1.0"
Configurations
Register new reCAPTCHA API keys
Add keys to /common/config/params.php:
return [ // reCAPTCHA API keys 'reCAPTCHA.siteKey' => 'xxxxxxxxx', 'reCAPTCHA.secretKey' => 'xxxxxxxxx', ];
In the form:
<?= $form->field($model, 'captcha', ['enableAjaxValidation' => false])->label(false) ->widget('demi\recaptcha\ReCaptcha', ['siteKey' => Yii::$app->params['reCAPTCHA.siteKey']]) ?>
In the model validation rules:
public function rules() { return [ // captcha [ ['captcha'], 'demi\recaptcha\ReCaptchaValidator', 'secretKey' => Yii::$app->params['reCAPTCHA.secretKey'], 'when' => function ($model) { /** @var $model self */ return !$model->hasErrors() && Yii::$app->user->isGuest; } ], }
统计信息
- 总下载量: 710
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: GNU
- 更新时间: 2015-07-10