zelenin/yii2-recaptcha-widget

This package is abandoned and no longer maintained. No replacement package was suggested.

Yii2 reCAPTCHA widget

0.0.1 2014-12-06 00:00 UTC

This package is not auto-updated.

Last update: 2016-04-10 08:40:24 UTC


README

Yii2 reCAPTCHA widget

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

See reCAPTCHA documentation

Author

Aleksandr Zelenin, e-mail: aleksandr@zelenin.me