PHPackages                             huubl/g-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. huubl/g-recaptcha

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

huubl/g-recaptcha
=================

Provides a form field which allows form to validate for non-bot submissions by giving them a challenge to decrypt an image.

2.0.3(8y ago)04PHP

Since Apr 4Pushed 3y agoCompare

[ Source](https://github.com/huubl/silverstripe-g-recaptcha)[ Packagist](https://packagist.org/packages/huubl/g-recaptcha)[ RSS](/packages/huubl-g-recaptcha/feed)WikiDiscussions master Synced yesterday

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

reCAPTCHA FormField Module
==========================

[](#recaptcha-formfield-module)

[![Build Status](https://camo.githubusercontent.com/1e372b54966852c8f2bfcb77c8367883e34dd4c10d8ea762e61befe72c7b9d50/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f6368696c6c752f73696c7665727374726970652d7265636170746368612e706e67)](http://travis-ci.org/chillu/silverstripe-recaptcha)

*This module is no longer supported. Please use [UndefinedOffset/silverstripe-nocaptcha](https://github.com/UndefinedOffset/silverstripe-nocaptcha) instead*

Introduction
------------

[](#introduction)

Provides a FormField which allows form to validate for non-bot submissions using Google's [reCAPTCHA v2](https://developers.google.com/recaptcha/docs/display) service.

In order to use Google's new [Invisible reCAPTCHA](https://developers.google.com/recaptcha/docs/invisible) service, please use the [undefinedoffset/silverstripe-nocaptcha](https://github.com/UndefinedOffset/silverstripe-nocaptcha) module. This module is not intended to be used with [reCAPTCHA v3](https://developers.google.com/recaptcha/docs/v3) (see [rationale](https://github.com/chillu/silverstripe-recaptcha/issues/55))

Requirements
------------

[](#requirements)

- SilverStripe Framework 4.0 or newer
- curl PHP module
- Requires [spamprotection](http://silverstripe.org/spam-protection-module/) module

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

[](#installation)

- Copy the `recaptcha` directory into your main SilverStripe webroot
- Run ?flush=1

This should go in your `mysite/_config/recaptcha.yml`. You can get an free API key at [https://www.google.com/recaptcha](https://www.google.com/recaptcha/admin/create)

```
SilverStripe\Recaptcha\RecaptchaField:
  public_api_key: "your-site-key"
  private_api_key: "your-secret-key"

```

If using on a site requiring a proxy server for outgoing traffic then you can set these additional options in your `mysite/_config/recaptcha.yml` by adding.

```
  proxy_server: "proxy_address"
  proxy_auth: "username:password"

```

To use the noscript fallback method, add the key `noscript_enabled: true` to your yml.

To change the language, add it to an array of options to your yml

```
  options:
    hl: NL
    theme: dark
    type: audio
    size: compact

```

See [https://developers.google.com/recaptcha/docs/display#render\_param](https://developers.google.com/recaptcha/docs/display#render_param) for all available parameters

Usage
-----

[](#usage)

### As a Standalone Field

[](#as-a-standalone-field)

If you want to use reCAPTCHA field by itself, you can simply just include it as a field in your form.

```
$recaptchaField = new RecaptchaField('MyCaptcha');
$recaptchaField->options = array('theme' => 'light'); // optional

```

See [reCAPTCHA docs](https://developers.google.com/recaptcha/docs/display#render_param) for more configuration options.

### Integration with spamprotection module

[](#integration-with-spamprotection-module)

This requires the [spamprotection](https://github.com/silverstripe/silverstripe-spamprotection) module to be installed, see its documentation for details. You can use this field to protect any built informs on your website, including user comments in the \[\[:modules:blog\]\] module.

Configuration example in `mysite/_config/spamprotection.yml`

```
---
name: spamprotection
---
SilverStripe\SpamProtection\Extension\FormSpamProtectionExtension:
  default_spam_protector: SilverStripe\Recaptcha\RecaptchaProtector

```

Then once you have setup this config you will need to include the spam protector field as per the instructions on the [spamprotection](https://github.com/silverstripe/silverstripe-spamprotection) page.

Known issues:
-------------

[](#known-issues)

### Problems with page doctype XHTML

[](#problems-with-page-doctype-xhtml)

reCAPTCHA current does not work if the page doctype is XHTML. The API returns Javascript which uses "document.write", which is not supported in XHTML. A work-around is to always use the no-script version of the module (modify the relevant lines in RecaptchaField.php), or to switch your webpage's doctype to HTML 4. See: [http://www.w3schools.com/tags/tag\_DOCTYPE.asp](http://www.w3schools.com/tags/tag_DOCTYPE.asp)

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 79.6% 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 ~193 days

Recently: every ~116 days

Total

10

Last Release

3043d ago

Major Versions

1.2.1 → 2.0.02016-10-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/4d26917b10f8c7a75c2aee51c98329366bfe6f62eb75fd0f4d49c4bbcffe6dc4?d=identicon)[huubl](/maintainers/huubl)

---

Top Contributors

[![chillu](https://avatars.githubusercontent.com/u/111025?v=4)](https://github.com/chillu "chillu (74 commits)")[![zanderwar](https://avatars.githubusercontent.com/u/13566916?v=4)](https://github.com/zanderwar "zanderwar (2 commits)")[![edwilde](https://avatars.githubusercontent.com/u/415374?v=4)](https://github.com/edwilde "edwilde (2 commits)")[![jedateach](https://avatars.githubusercontent.com/u/1356335?v=4)](https://github.com/jedateach "jedateach (2 commits)")[![ajshort](https://avatars.githubusercontent.com/u/31570?v=4)](https://github.com/ajshort "ajshort (2 commits)")[![UndefinedOffset](https://avatars.githubusercontent.com/u/1391558?v=4)](https://github.com/UndefinedOffset "UndefinedOffset (1 commits)")[![flamerohr](https://avatars.githubusercontent.com/u/1064889?v=4)](https://github.com/flamerohr "flamerohr (1 commits)")[![JarkkoLinnanvirta](https://avatars.githubusercontent.com/u/5046663?v=4)](https://github.com/JarkkoLinnanvirta "JarkkoLinnanvirta (1 commits)")[![wilr](https://avatars.githubusercontent.com/u/101629?v=4)](https://github.com/wilr "wilr (1 commits)")[![nedmas](https://avatars.githubusercontent.com/u/842280?v=4)](https://github.com/nedmas "nedmas (1 commits)")[![philbenoit](https://avatars.githubusercontent.com/u/1376814?v=4)](https://github.com/philbenoit "philbenoit (1 commits)")[![tomspeak](https://avatars.githubusercontent.com/u/2415569?v=4)](https://github.com/tomspeak "tomspeak (1 commits)")[![tractorcow](https://avatars.githubusercontent.com/u/936064?v=4)](https://github.com/tractorcow "tractorcow (1 commits)")[![anselmdk](https://avatars.githubusercontent.com/u/1316533?v=4)](https://github.com/anselmdk "anselmdk (1 commits)")[![andrewandante](https://avatars.githubusercontent.com/u/9702648?v=4)](https://github.com/andrewandante "andrewandante (1 commits)")[![edlinklater](https://avatars.githubusercontent.com/u/1176635?v=4)](https://github.com/edlinklater "edlinklater (1 commits)")

---

Tags

silverstripespamprotection

### Embed Badge

![Health badge](/badges/huubl-g-recaptcha/health.svg)

```
[![Health](https://phpackages.com/badges/huubl-g-recaptcha/health.svg)](https://phpackages.com/packages/huubl-g-recaptcha)
```

###  Alternatives

[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)[silverstripe/mathspamprotection

This module provides a simple math protection mechanism for prevent spam from your forms.Includes an EditableMathSpamField to integrate with the UserForms module.

1917.6k](/packages/silverstripe-mathspamprotection)[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)

PHPackages © 2026

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