PHPackages                             gbksoft/yii2-recaptcha-widget - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. gbksoft/yii2-recaptcha-widget

ActiveYii2-extension

gbksoft/yii2-recaptcha-widget
=============================

Yii2 reCAPTCHA widget

0599PHP

Since May 24Pushed 9y ago2 watchersCompare

[ Source](https://github.com/gbksoft/yii2-recaptcha-widget)[ Packagist](https://packagist.org/packages/gbksoft/yii2-recaptcha-widget)[ RSS](/packages/gbksoft-yii2-recaptcha-widget/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Yii2 reCAPTCHA widget
=====================

[](#yii2-recaptcha-widget)

[Yii2](http://www.yiiframework.com) [reCAPTCHA](https://www.google.com/recaptcha/intro/index.html) widget.

Installation
------------

[](#installation)

### Composer

[](#composer)

The preferred way to install this extension is through [Composer](http://getcomposer.org/).

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
-----

[](#usage)

[Register](https://www.google.com/recaptcha/admin) a new site.

Add captcha attribute to model:

```
public $captcha;

public function rules()
{
    return [
        [
            'captcha',
            \gbksoft\recaptcha\validators\RecaptchaValidator::class,
            'secret' => ''
        ]
    ];
}
```

Add field to view:

```
