gbksoft/yii2-recaptcha-widget

Yii2 reCAPTCHA widget

Installs: 599

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 3

Forks: 0

Open Issues: 0

Type:yii2-extension

dev-master 2016-05-24 11:26 UTC

This package is not auto-updated.

Last update: 2024-12-16 13:13:31 UTC


README

Yii2 reCAPTCHA widget.

Installation

Composer

The preferred way to install this extension is through Composer.

Either run

php composer.phar require gbksoft/yii2-recaptcha-widget "*"

or add

"gbksoft/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',
            \gbksoft\recaptcha\validators\RecaptchaValidator::class,
            'secret' => '<your-secret>'
        ]
    ];
}

Add field to view:

<?= $form->field($model, 'captcha')->widget(\gbksoft\recaptcha\widgets\Recaptcha::class, [
    'clientOptions' => [
        'data-sitekey' => '<your-sitekey>'
    ]
]) ?>

Info

See reCAPTCHA documentation