Skip to content

gbksoft/yii2-recaptcha-widget

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yii2 reCAPTCHA widget

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages