zelenin / yii2-recaptcha-widget
Yii2 reCAPTCHA widget
Installs: 1 750
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 1
Forks: 2
Open Issues: 1
Type:yii2-extension
pkg:composer/zelenin/yii2-recaptcha-widget
Requires
- yiisoft/yii2: ~2
This package is not auto-updated.
Last update: 2016-04-10 08:40:24 UTC
README
Yii2 reCAPTCHA widget
Installation
Composer
The preferred way to install this extension is through Composer.
Either run
php composer.phar require zelenin/yii2-recaptcha-widget "*"
or add
"zelenin/yii2-recaptcha-widget": "*"
to the require section of your composer.json
Usage
Register a new site.
Add captcha attribute to model:
public $captcha;
public function rules()
{
    return [
        [
            'captcha',
            'Zelenin\yii\widgets\Recaptcha\validators\RecaptchaValidator',
            'secret' => '<your-secret>'
        ]
    ];
}
Add field to view:
<?= $form->field($model, 'captcha')->widget('Zelenin\yii\widgets\Recaptcha\widgets\Recaptcha', [
    'clientOptions' => [
        'data-sitekey' => '<your-sitekey>'
    ]
]) ?>
Info
Author
Aleksandr Zelenin, e-mail: [email protected]