PHPackages                             z1bun/yii2-module-recaptcha-v3 - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. z1bun/yii2-module-recaptcha-v3

ActiveYii2-extension[Authentication &amp; Authorization](/categories/authentication)

z1bun/yii2-module-recaptcha-v3
==============================

This is reCAPTCHA v3 for Yii2.

2.0(6y ago)0291BSD-3-ClausePHP

Since Dec 22Pushed 6y agoCompare

[ Source](https://github.com/z1bun/yii2-module-recaptcha-v3)[ Packagist](https://packagist.org/packages/z1bun/yii2-module-recaptcha-v3)[ RSS](/packages/z1bun-yii2-module-recaptcha-v3/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (1)Versions (7)Used By (0)

Yii2 reCAPTCHA v3
=================

[](#yii2-recaptcha-v3)

Adds [recaptcha-v3](https://developers.google.com/recaptcha/docs/v3) into yii2 project

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist z1bun/yii2-module-recaptcha-v3 "dev-master"

```

or add

```
"z1bun/yii2-module-recaptcha-v3": "dev-master"

```

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

Usage
-----

[](#usage)

Once the extension is installed, simply use it in your code by :

add this to your components main.php

```
'components' => [
    ...
    'reCaptcha3' => [
        'class'      => 'z1bun\recaptcha3\ReCaptcha',
        'siteKey' => env('recaptcha_site_key'),
        'secretKey' => env('recaptcha_secret_key'),
    ],
```

and in your model

acceptance\_score the minimum score for this request (0.0 - 1.0) or null

```
public $reCaptcha;

public function rules()
{
 	return [
 		...
 		 [['reCaptcha'], \z1bun\recaptcha3\ReCaptchaValidator::class, 'acceptance_score' => 0]
 	];
}
```

```
