PHPackages                             richweber/yii2-recaptcha - 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. [Security](/categories/security)
4. /
5. richweber/yii2-recaptcha

ActiveYii2-extension[Security](/categories/security)

richweber/yii2-recaptcha
========================

Yii 2 Framework extension for Google reCAPTCHA

1.0.0(11y ago)143.5k↓37.1%[1 issues](https://github.com/RichWeber/yii2-recaptcha/issues)BSD-3-ClausePHP

Since Dec 13Pushed 11y ago2 watchersCompare

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

READMEChangelogDependencies (1)Versions (2)Used By (0)

Yii2 extension for Google reCAPTCHA
===================================

[](#yii2-extension-for-google-recaptcha)

ReCAPTCHA lets you embed a CAPTCHA in your web pages in order to protect them against spam and other types of automated abuse.

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

[](#installation)

Adding reCAPTCHA to your site consists of three steps:

1. [Getting started](http://www.google.com/recaptcha/admin)
2. Displaying the widget
3. Verifying the user's response

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

Either run

```
$ php composer.phar require richweber/yii2-recaptcha "dev-master"

```

or add

```
"richweber/yii2-recaptcha": "dev-master"

```

to the `require` section of your `composer.json` file.

Usage
-----

[](#usage)

### Component Configuration

[](#component-configuration)

```
'components' => [
    ...
    'recaptcha' => [
        'class' => 'richweber\recaptcha\ReCaptcha',
        'siteKey' => 'https://www.google.com/recaptcha/admin',
        'secretKey' => 'https://www.google.com/recaptcha/admin',
        'errorMessage' => 'Are you robot?',
    ],
    ...
],
```

### Displaying the widget

[](#displaying-the-widget)

```
use richweber\recaptcha\Captcha;
