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

ActiveCraft-plugin[Authentication &amp; Authorization](/categories/authentication)

matt-west/craft-recaptcha
=========================

Integrate Google’s reCAPTCHA into your forms.

3.0.0(1y ago)1959.9k↑66.7%15[4 issues](https://github.com/matt-west/craft-recaptcha/issues)[1 PRs](https://github.com/matt-west/craft-recaptcha/pulls)1MITPHPCI failing

Since Mar 17Pushed 1y ago1 watchersCompare

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

READMEChangelog (10)Dependencies (2)Versions (15)Used By (1)

Craft reCAPTCHA plugin for Craft CMS 4.x
========================================

[](#craft-recaptcha-plugin-for-craft-cms-4x)

Integrate Google’s reCAPTCHA into your forms. Includes support for the CraftCMS [Contact Form](https://github.com/craftcms/contact-form) plugin.

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

[](#requirements)

This plugin requires Craft CMS 5 or later.

**This plugin supports reCAPTCHA v2 only.**

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

[](#installation)

To install the plugin, follow these instructions.

1. Open your terminal and go to your Craft project:

    ```
     cd /path/to/project

    ```
2. Then tell Composer to load the plugin:

    ```
     composer require matt-west/craft-recaptcha

    ```
3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Craft reCAPTCHA.

Configuring Craft reCAPTCHA
---------------------------

[](#configuring-craft-recaptcha)

1. [Sign up for reCAPTCHA API key](https://www.google.com/recaptcha/admin).
2. Open the Craft admin and go to Settings → Plugins → Craft reCAPTCHA → Settings.
3. Add your `site key` and `secret key`, then save.
4. Add the reCAPTCHA template tag to your forms. (see next section)

If you’re using the CraftCMS [Contact Form](https://github.com/craftcms/contact-form) plugin, everything is already set up for you.

### Verify the reCAPTCHA

[](#verify-the-recaptcha)

To verify the reCAPTCHA is valid, pass the reCAPTCHA response from the `g-recaptcha-response` param to the `verify()` method on `CraftRecaptcha::$plugin->craftRecaptchaService`.

```
// Get the reCAPTCHA response code to validate.
$captcha = Craft::$app->getRequest()->getParam('g-recaptcha-response');

// Pass the response code to the verification service.
$validates = CraftRecaptcha::$plugin->craftRecaptchaService->verify($captcha);

if ($validates) {
  // All good! the reCAPTCHA is valid.
} else {
  // The reCAPTCHA is invalid.
}
```

Or alternatively, use the in-built verification controller action to verify the request before forwarding it on to the intended action.

For example, the following fields would verify the reCAPTCHA and then pass the request to the login controller action:

```

{{ craft.recaptcha.render() }}
```

Set the `action` field to be `recaptcha/recaptcha/verify-submission` and the `verified-action` field to be the intended controller action you want to trigger. This will forward all other fields and parameters to the intended controller action.

### Automated testing and reCAPTCHA

[](#automated-testing-and-recaptcha)

If you need to run automated tests against your forms use the following keys. Verification requests using these credentials will always pass.

Site key: `6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI`Secret key: `6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe`

[Documentation](https://developers.google.com/recaptcha/docs/faq#id-like-to-run-automated-tests-with-recaptcha-v2-what-should-i-do)

Using Craft reCAPTCHA
---------------------

[](#using-craft-recaptcha)

Add the following tag to your form where you’d like the reCAPTCHA to be displayed.

```
{{ craft.recaptcha.render() }}
```

Render parameters [per the documentation](https://developers.google.com/recaptcha/docs/display#render_param) are injectable to the `render()` function, e.g.

```
{{ craft.recaptcha.render({
  theme: 'dark',
  size: 'compact'
}) }}
```

You can also create the reCAPTCHA element yourself using the `sitekey` template variable. This is especially useful for implementing invisible recaptcha.

```

```

---

Brought to you by [Matt West](https://mattwest.io)

###  Health Score

45

—

FairBetter than 92% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 58.3% 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 ~192 days

Recently: every ~284 days

Total

13

Last Release

667d ago

Major Versions

1.5.3 → 2.0.12022-09-10

2.0.2 → 3.0.02024-07-12

### Community

Maintainers

![](https://www.gravatar.com/avatar/85ba2f7bc2bb7568496ae484374c15fe87abc984f58bdabe131330a73acaddf2?d=identicon)[matt-west](/maintainers/matt-west)

---

Top Contributors

[![matt-west](https://avatars.githubusercontent.com/u/417538?v=4)](https://github.com/matt-west "matt-west (35 commits)")[![honsa](https://avatars.githubusercontent.com/u/526006?v=4)](https://github.com/honsa "honsa (9 commits)")[![martywallace](https://avatars.githubusercontent.com/u/606154?v=4)](https://github.com/martywallace "martywallace (3 commits)")[![andreapasotti](https://avatars.githubusercontent.com/u/2439440?v=4)](https://github.com/andreapasotti "andreapasotti (3 commits)")[![billythekid](https://avatars.githubusercontent.com/u/330170?v=4)](https://github.com/billythekid "billythekid (3 commits)")[![domstubbs](https://avatars.githubusercontent.com/u/717265?v=4)](https://github.com/domstubbs "domstubbs (2 commits)")[![totov](https://avatars.githubusercontent.com/u/2348955?v=4)](https://github.com/totov "totov (2 commits)")[![MDXDave](https://avatars.githubusercontent.com/u/6099976?v=4)](https://github.com/MDXDave "MDXDave (1 commits)")[![parwinderD4D](https://avatars.githubusercontent.com/u/46927214?v=4)](https://github.com/parwinderD4D "parwinderD4D (1 commits)")[![tvd0x2a](https://avatars.githubusercontent.com/u/89363871?v=4)](https://github.com/tvd0x2a "tvd0x2a (1 commits)")

---

Tags

craft-plugincraftcmscraftcms-plugincmsCraftcraftcmscraft-plugincraft recaptcha

### Embed Badge

![Health badge](/badges/matt-west-craft-recaptcha/health.svg)

```
[![Health](https://phpackages.com/badges/matt-west-craft-recaptcha/health.svg)](https://phpackages.com/packages/matt-west-craft-recaptcha)
```

###  Alternatives

[verbb/knock-knock

Password protect your public facing Craft website with a single password.

17122.8k7](/packages/verbb-knock-knock)[jamesedmonston/graphql-authentication

GraphQL authentication for your headless Craft CMS applications.

2917.0k](/packages/jamesedmonston-graphql-authentication)[acclaro/translations

Easily launch and manage multilingual Craft websites without having to copy/paste content or manually track updates.

1229.5k](/packages/acclaro-translations)[thejoshsmith/craft-fab-permissions

Give yourself better control over your sections with Craft Field and Tab (FAB) Permissions. Restrict which tabs and fields are visible to different user groups.

1611.5k](/packages/thejoshsmith-craft-fab-permissions)

PHPackages © 2026

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