gbksoft / yii2-recaptcha-widget
Yii2 reCAPTCHA widget
Package info
github.com/gbksoft/yii2-recaptcha-widget
Type:yii2-extension
pkg:composer/gbksoft/yii2-recaptcha-widget
dev-master
2016-05-24 11:26 UTC
Requires
- yiisoft/yii2: >=2.0.6
This package is not auto-updated.
Last update: 2026-03-09 19:01:18 UTC
README
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>' ] ]) ?>