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

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

luyadev/yii2-recaptcha-widget
=============================

Yii2 Google reCAPTCHA v2 and v3 widget

1.0.1(2mo ago)118.0k—8.9%12MITPHPPHP &gt;=7.4CI passing

Since Aug 16Pushed 2mo agoCompare

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

READMEChangelog (2)Dependencies (3)Versions (3)Used By (2)

 [![LUYA Logo](https://raw.githubusercontent.com/luyadev/luya/master/docs/logo/luya-logo-0.2x.png)](https://raw.githubusercontent.com/luyadev/luya/master/docs/logo/luya-logo-0.2x.png)

Google reCAPTCHA widget
=======================

[](#google-recaptcha-widget)

> **THIS IS A FORK FROM THE ARCHIVED [HIMIKLAB](https://github.com/himiklab/yii2-recaptcha-widget) REPOSITORY. THE MAIN GOAL IS TO SUPPORT LATEST PHP VERSIONS**

[![Tests](https://github.com/luyadev/yii2-recaptcha-widget/actions/workflows/tests.yml/badge.svg)](https://github.com/luyadev/yii2-recaptcha-widget/actions/workflows/tests.yml)[![Total Downloads](https://camo.githubusercontent.com/945841b9140ec911a4f82cf8f9d323dbdba4b2e1e0b4406f14eff6c8075007c3/68747470733a2f2f706f7365722e707567782e6f72672f6c7579616465762f796969322d7265636170746368612d7769646765742f646f776e6c6f616473)](https://packagist.org/packages/luyadev/yii2-recaptcha-widget)

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

[](#installation)

```
composer require luyadev/yii2-recaptcha-widget
```

Sign up [for an reCAPTCHA API keys](https://www.google.com/recaptcha/admin/create) and configure the component in your configuration file.

```
'components' => [
    'reCaptcha' => [
        'class' => 'luyadev\recaptcha\ReCaptchaConfig',
        'siteKeyV2' => 'your siteKey v2',
        'secretV2' => 'your secret key v2',
        'siteKeyV3' => 'your siteKey v3',
        'secretV3' => 'your secret key v3',
    ],
    ...
```

Add `ReCaptchaValidator2` or `ReCaptchaValidator3` as validator into your model, do not forget to set those attributes as required.

```
public $reCaptcha;

public function rules()
{
    return [
        [['reCaptcha'], 'required'],
        [['reCaptcha'], \luyadev\recaptcha\ReCaptchaValidator2::class, 'uncheckedMessage' => 'Please confirm that you are not a bot.'],
    ];
}
```

```
public $reCaptcha;

public function rules()
{
    return [
        [['reCaptcha'], 'required'],
        [['reCaptcha'], \luyadev\recaptcha\ReCaptchaValidator3::class, 'threshold' => 0.5, 'action' => 'homepage'],
    ];
}
```

Usage in the view files for ActiveForm:

> NOTE: Disable ajax validation for ReCaptcha field!

```
$form->field($model, 'reCaptcha')->widget(\luyadev\recaptcha\ReCaptcha2::class) // v2
```

```
$form->field($model, 'reCaptcha')->widget(\luyadev\recaptcha\ReCaptcha3::class, ['action' => 'homepage']) // v3
```

as widgets:

```
\luyadev\recaptcha\ReCaptcha2::widget([
    'name' => 'reCaptcha',
    'widgetOptions' => ['class' => 'col-sm-offset-3'],
]);
```

v3

```
\luyadev\recaptcha\ReCaptcha3::widget([
    'name' => 'reCaptcha',
    'action' => 'homepage',
    'widgetOptions' => ['class' => 'col-sm-offset-3'],
]);
```

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance83

Actively maintained with recent releases

Popularity30

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~922 days

Total

2

Last Release

85d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/86184bf08843ed8fcc4aedb2fdecd8a9e832e47e89a7166cebfda529c176f5ce?d=identicon)[nadar](/maintainers/nadar)

---

Top Contributors

[![himiklab](https://avatars.githubusercontent.com/u/6266409?v=4)](https://github.com/himiklab "himiklab (59 commits)")[![nadar](https://avatars.githubusercontent.com/u/3417221?v=4)](https://github.com/nadar "nadar (11 commits)")[![sashsvamir](https://avatars.githubusercontent.com/u/1404421?v=4)](https://github.com/sashsvamir "sashsvamir (3 commits)")[![anders-akero](https://avatars.githubusercontent.com/u/2418493?v=4)](https://github.com/anders-akero "anders-akero (3 commits)")[![RichWeber](https://avatars.githubusercontent.com/u/1702252?v=4)](https://github.com/RichWeber "RichWeber (2 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (2 commits)")[![elvenpath](https://avatars.githubusercontent.com/u/1319068?v=4)](https://github.com/elvenpath "elvenpath (2 commits)")[![eugenekkh](https://avatars.githubusercontent.com/u/8081158?v=4)](https://github.com/eugenekkh "eugenekkh (2 commits)")[![mmlado](https://avatars.githubusercontent.com/u/10460806?v=4)](https://github.com/mmlado "mmlado (2 commits)")[![p0vidl0](https://avatars.githubusercontent.com/u/6966538?v=4)](https://github.com/p0vidl0 "p0vidl0 (1 commits)")[![rolandschaub](https://avatars.githubusercontent.com/u/3786245?v=4)](https://github.com/rolandschaub "rolandschaub (1 commits)")[![werew01f](https://avatars.githubusercontent.com/u/6412850?v=4)](https://github.com/werew01f "werew01f (1 commits)")[![Borales](https://avatars.githubusercontent.com/u/1118933?v=4)](https://github.com/Borales "Borales (1 commits)")[![ferrumfist](https://avatars.githubusercontent.com/u/14904438?v=4)](https://github.com/ferrumfist "ferrumfist (1 commits)")[![igorrarruda](https://avatars.githubusercontent.com/u/10922552?v=4)](https://github.com/igorrarruda "igorrarruda (1 commits)")[![Kompaneytsev](https://avatars.githubusercontent.com/u/8995049?v=4)](https://github.com/Kompaneytsev "Kompaneytsev (1 commits)")[![koteq](https://avatars.githubusercontent.com/u/1192090?v=4)](https://github.com/koteq "koteq (1 commits)")[![mauriziocingolani](https://avatars.githubusercontent.com/u/4015015?v=4)](https://github.com/mauriziocingolani "mauriziocingolani (1 commits)")[![mohsen1369](https://avatars.githubusercontent.com/u/2553042?v=4)](https://github.com/mohsen1369 "mohsen1369 (1 commits)")[![NecroMan](https://avatars.githubusercontent.com/u/488178?v=4)](https://github.com/NecroMan "NecroMan (1 commits)")

---

Tags

googlerecaptchacaptchayii2widget

### Embed Badge

![Health badge](/badges/luyadev-yii2-recaptcha-widget/health.svg)

```
[![Health](https://phpackages.com/badges/luyadev-yii2-recaptcha-widget/health.svg)](https://phpackages.com/packages/luyadev-yii2-recaptcha-widget)
```

###  Alternatives

[arcanedev/no-captcha

No CAPTCHA (new Google reCAPTCHA) with Laravel support

370730.4k6](/packages/arcanedev-no-captcha)[contributte/recaptcha

Google reCAPTCHA for Nette - Forms

421.3M4](/packages/contributte-recaptcha)[crabstudio/recaptcha

Easily use Google Recaptcha in CakePHP projects

20112.2k1](/packages/crabstudio-recaptcha)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
