PHPackages                             cyber-duck/silverstripe-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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. cyber-duck/silverstripe-recaptcha

ActiveSilverstripe-vendormodule[Validation &amp; Sanitization](/categories/validation)

cyber-duck/silverstripe-recaptcha
=================================

Standard reCAPTCHA and invisible reCAPTCHA form fields for SilverStripe

4.1(3y ago)43.8k4MITPHP

Since Mar 6Pushed 2y ago3 watchersCompare

[ Source](https://github.com/Cyber-Duck/SilverStripe-Recaptcha)[ Packagist](https://packagist.org/packages/cyber-duck/silverstripe-recaptcha)[ Docs](https://github.com/cyber-duck/silverstripe-recaptcha)[ RSS](/packages/cyber-duck-silverstripe-recaptcha/feed)WikiDiscussions develop Synced 2mo ago

READMEChangelog (3)Dependencies (1)Versions (5)Used By (0)

Silverstripe-Recaptcha
======================

[](#silverstripe-recaptcha)

Standard reCAPTCHA and invisible reCAPTCHA form fields for SilverStripe

[![Latest Stable Version](https://camo.githubusercontent.com/169f03d947e76cfe1ccbffda8538981fb5874aa21c7257c138108db63e548568/68747470733a2f2f706f7365722e707567782e6f72672f63796265722d6475636b2f73696c7665727374726970652d7265636170746368612f762f737461626c65)](https://packagist.org/packages/cyber-duck/silverstripe-recaptcha)[![Latest Unstable Version](https://camo.githubusercontent.com/be6fc0347f63010a2cd283f89e7a585428daae8c8971f0ad71cea72cadfcac3e/68747470733a2f2f706f7365722e707567782e6f72672f63796265722d6475636b2f73696c7665727374726970652d7265636170746368612f762f756e737461626c65)](https://packagist.org/packages/cyber-duck/silverstripe-recaptcha)[![Total Downloads](https://camo.githubusercontent.com/09ec0bdc54f1c048adb6e887c731bbcb581cc9d306e0b0a6648d781c08e70de6/68747470733a2f2f706f7365722e707567782e6f72672f63796265722d6475636b2f73696c7665727374726970652d7265636170746368612f646f776e6c6f616473)](https://packagist.org/packages/cyber-duck/silverstripe-recaptcha)[![License](https://camo.githubusercontent.com/1e4bcd42881cae87dbc4da047f7a60d6db93deac00cf90516bdf9cf85d1860fe/68747470733a2f2f706f7365722e707567782e6f72672f63796265722d6475636b2f73696c7665727374726970652d7265636170746368612f6c6963656e7365)](https://packagist.org/packages/cyber-duck/silverstripe-recaptcha)

Author: [Andrew Mc Cormack](https://github.com/Andrew-Mc-Cormack)

**For SilverStripe 4.\***

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

[](#installation)

Add the following to your composer.json file and run /dev/build?flush=all

```
{
    "require": {
        "cyber-duck/silverstripe-recaptcha": "4.0.*"
    }
}
```

Standard Recaptcha
------------------

[](#standard-recaptcha)

Add 2 .env vars with your recaptcha keys

```
RECAPTCHA_SITE_KEY="0000000000"
RECAPTCHA_SECRET_KEY="0000000000"

```

Add the field to any form on your site just as you would any other field. Pass in:

- the field name. Also add the field to the required fields list.

```
use CyberDuck\Recaptcha\Forms\RecaptchaField;

$fields = FieldList::create([
	RecaptchaField::create('Recaptcha');
]);

$validator = RequiredFields::create([
    'Recaptcha'
]);
```

Invisible Recaptcha
-------------------

[](#invisible-recaptcha)

Add 2 .env vars with your recaptcha keys

```
RECAPTCHA_INVISIBLE_SITE_KEY="0000000000"
RECAPTCHA_INVISIBLE_SECRET_KEY="0000000000"

```

Add the field to any form on your site just as you would any other field. Pass in:

- the field name,
- the form ID (without #)
- the HTML element ID (without #) or selector (such as button) to render the reCAPTCHA widget. Also add the field to the required fields list.

```
use CyberDuck\Recaptcha\Forms\InvisibleRecaptchaField;

$fields = FieldList::create([
	InvisibleRecaptchaField::create(
	    'Recaptcha',
	    'MemberLoginForm_LoginForm',
	    'MemberLoginForm_LoginForm_action_doLogin'
	);
]);

$validator = RequiredFields::create([
    'Recaptcha'
]);
```

Working with jQuery and AJAX
----------------------------

[](#working-with-jquery-and-ajax)

If you would like to use the reCAPTCHA with AJAX you can copy the InvisibleRecaptcha.ss from the module templates folder into your theme templates folder

```

    var onRecaptchaFormSubmit = function(token) {
        document.getElementById('{$FormID}').submit();
    };
    var onloadCallback = function() {
        grecaptcha.render('{$Container}', {
        'sitekey' : '{$SiteKey}',
        'callback' : onRecaptchaFormSubmit
        });
    };

```

And just update the onRecaptchaFormSubmit function to use jQuery to select and submit the form

```

    var onRecaptchaFormSubmit = function(token) {
        $('#{$FormID}').submit();
    };
    var onloadCallback = function() {
        grecaptcha.render('{$Container}', {
        'sitekey' : '{$SiteKey}',
        'callback' : onRecaptchaFormSubmit
        });
    };

```

In your AJAX success function, if your form fails validation you can call onloadCallback() to re-render the reCAPTCHA

```
onloadCallback()
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~654 days

Total

3

Last Release

1317d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0c45a99726cc30692bc4821cfc198df1f5de85b1a15f9b66a0bf739acbac0309?d=identicon)[cyber-duck](/maintainers/cyber-duck)

---

Top Contributors

[![worzy](https://avatars.githubusercontent.com/u/1092417?v=4)](https://github.com/worzy "worzy (1 commits)")

---

Tags

googlephprecaptchasilverstripesilverstripe-4silverstriperecaptcha

### Embed Badge

![Health badge](/badges/cyber-duck-silverstripe-recaptcha/health.svg)

```
[![Health](https://phpackages.com/badges/cyber-duck-silverstripe-recaptcha/health.svg)](https://phpackages.com/packages/cyber-duck-silverstripe-recaptcha)
```

###  Alternatives

[karser/karser-recaptcha3-bundle

Google ReCAPTCHA v3 for Symfony

1862.4M7](/packages/karser-karser-recaptcha3-bundle)[undefinedoffset/silverstripe-nocaptcha

A spam protector and form field using Google's reCAPTCHA v2 or optionally a foundation v3 implementation

33471.6k16](/packages/undefinedoffset-silverstripe-nocaptcha)[uestla/recaptcha-control

reCAPTCHA control for Nette Framework forms

26572.0k1](/packages/uestla-recaptcha-control)[sheadawson/silverstripe-zenvalidator

Faster, easier client and server-side form validation for SilverStripe

5778.4k2](/packages/sheadawson-silverstripe-zenvalidator)[jonom/silverstripe-text-target-length

Set character length recommendations on SilverStripe text form fields

32132.4k9](/packages/jonom-silverstripe-text-target-length)[abanoubnassem/filament-grecaptcha-field

Provides a Google reCaptcha V2 field for the Filament Forms

27116.1k2](/packages/abanoubnassem-filament-grecaptcha-field)

PHPackages © 2026

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