PHPackages                             kmergen/yii2-recaptcha3 - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. kmergen/yii2-recaptcha3

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

kmergen/yii2-recaptcha3
=======================

A validator and a widget for Google ReCaptcha 3

07PHP

Since Jan 3Pushed 4y ago1 watchersCompare

[ Source](https://github.com/kmergen/yii2-recaptcha3)[ Packagist](https://packagist.org/packages/kmergen/yii2-recaptcha3)[ RSS](/packages/kmergen-yii2-recaptcha3/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Yii2 ReCaptcha 3
================

[](#yii2-recaptcha-3)

Yii2 ReCaptcha3 provide a validator and a widget for Google ReCaptcha 3.

It needs no jQuery.

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

Either run

```
composer require "kmergen/yii2-recaptcha3: "*"
```

or add

```
"kmergen/yii2-recaptcha3": "*",

```

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

### 2. Configuration

[](#2-configuration)

In your configuration file set the following:

```
'components' => [
    ...
    'recaptcha3' => [
        'class'      => 'kmergen\recaptcha3\RecaptchaConfig',
        'siteKey'   => 'google_recaptcha_v3_site key',
        'secret' => 'google_recaptcha_v3_secret key',
    ],
    ...
]
```

### 2. Set Validator in Model

[](#2-set-validator-in-model)

```
public $recaptcha;

public function rules()
{
 	return [
 		...
 		 [['recaptcha'], \kmergen\recaptcha3\RecaptchaValidator::class, 'threshold' => 0.5]
 	];
}
```

and then in form view

```
