PHPackages                             cake17/cakephp-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. [Security](/categories/security)
4. /
5. cake17/cakephp-recaptcha

ActiveCakephp-plugin[Security](/categories/security)

cake17/cakephp-recaptcha
========================

\[DEPRECIATED\] Please use https://github.com/cakephp-fr/recaptcha/

0.3.4(10y ago)1211.0k31MITPHPPHP &gt;=5.4

Since Dec 15Pushed 10y ago2 watchersCompare

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

READMEChangelog (10)Dependencies (3)Versions (12)Used By (1)

Google reCAPTCHA for CakePHP 3
==============================

[](#google-recaptcha-for-cakephp-3)

[![Build Status](https://camo.githubusercontent.com/00c2881525507251136e692ed18042c6fc6265a0ca631d5e8da3d57ef526d42a/68747470733a2f2f6170692e7472617669732d63692e6f72672f63616b6531372f63616b657068702d7265636170746368612e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/cake17/cakephp-recaptcha)[![Latest Stable Version](https://camo.githubusercontent.com/1e4a59b0e962d165ebb67d67673d497fc45a1df1b033389817964a011c0a2e83/68747470733a2f2f706f7365722e707567782e6f72672f63616b6531372f63616b657068702d7265636170746368612f762f737461626c652e706e67)](https://packagist.org/packages/cake17/cakephp-recaptcha)[![Minimum PHP Version](https://camo.githubusercontent.com/b8feeff753e7c6ff51ffd26c612be3c4f292513e413cd0c8884e665ff51dd798/687474703a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230352e342d3838393242462e737667)](https://php.net/)[![License](https://camo.githubusercontent.com/8844b58a0b4c6287f7997619a9f22d4f50d8368543a63ab884c17cc444b24646/68747470733a2f2f706f7365722e707567782e6f72672f63616b6531372f63616b657068702d7265636170746368612f6c6963656e73652e706e67)](https://packagist.org/packages/cake17/cakephp-recaptcha)[![Total Downloads](https://camo.githubusercontent.com/d52178c5fa7694765273da92bac2a558fa2066e760d20fa23fc6a89b8a4ef1f7/68747470733a2f2f706f7365722e707567782e6f72672f63616b6531372f63616b657068702d7265636170746368612f642f746f74616c2e706e67)](https://packagist.org/packages/cake17/cakephp-recaptcha)

This plugin is still under development...

Plugin's Objective
------------------

[](#plugins-objective)

This plugin adds functionalities to use the new Google reCAPTCHA in CakePHP projects. For now multiple widgets on a single page is not available.

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

[](#requirements)

- PHP &gt;= 5.4.16
- [CakePHP 3.x](http://book.cakephp.org/3.0/en/index.html)
- Server under `localhost` name. Be aware that the widgets will not be displayed if you have a vhost named local.dev/dev/ for instance.

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

[](#installation)

*\[Using [Composer](http://getcomposer.org/)\]*

Add the plugin to your project's `composer.json` - something like this:

```
{
    "require": {
        "cake17/cakephp-recaptcha": "dev-master"
    }
}
```

And run `composer update`.

Because this plugin has the type `cakephp-plugin` set in it's own `composer.json`, composer knows to install it inside your `/vendor` directory. It is recommended that you add `/vendor` to your .gitignore file. (Why? [read this](http://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md).)

Usage of plugin
---------------

[](#usage-of-plugin)

### 1. Enable the plugin

[](#1-enable-the-plugin)

In your `config/bootstrap.php` file:

```
Plugin::load('Recaptcha', ['routes' => true, 'bootstrap' => true]);

```

### 2. Go to Google reCAPTCHA site

[](#2-go-to-google-recaptcha-site)

Go [here](https://www.google.com/recaptcha/intro/index.html) to create a pair of keys for your website.

### 3. Create or copy the reCAPTCHA config file

[](#3-create-or-copy-the-recaptcha-config-file)

- Either copy the default file in `/config/recaptcha.php` from `/vendor/cake17/cakephp-recaptcha/config/recaptcha.default.php`.
- Either use the composer install command to add in composer.json that will make the copy for you To use it, add the following snippet in your project composer.json and run `composer run-script post-install-cmd` after::

    ```
    ...
    "scripts": {
      "post-install-cmd": [
        "Recaptcha\\Console\\Installer::postInstall"
      ]
    }
    ...

    ```

Whatever the method you used to copy the recaptcha config file, don't forget to put `/config/recaptcha.php` file in .gitignore.

### 4. Fullfill the information in `/config/recaptcha.php`

[](#4-fullfill-the-information-in-configrecaptchaphp)

- sitekey: get it on google website
- secret: get it on google website
- lang: see the list on google website
- theme: dark or light
- type: image or audio

If you don't have a key and a secret, an exception will be raised.

### 5. Then add the component in your controller where you need the reCAPTCHA.

[](#5-then-add-the-component-in-your-controller-where-you-need-the-recaptcha)

For example:

```
public function initialize() {
    parent::initialize();
    if ($this->request->action === 'contact') {
        $this->loadComponent('Recaptcha.Recaptcha');
    }
}

```

### 6. Add the following in your controller.

[](#6-add-the-following-in-your-controller)

```
public function contact() {
    if ($this->request->is('post')) {
        if ($this->Recaptcha->verify()) {
            if ($contact->execute($this->request->data)) {
                $this->Flash->success(__('We will get back to you soon.'));
                return $this->redirect($this->referer());
            } else {
                $this->Flash->error(__('There was a problem submitting your form.'));
            }
        } else {
            $this->Flash->error(__('Please check your Recaptcha Box.'));
        }
    }
}

```

### 7. No need to add the helper.

[](#7-no-need-to-add-the-helper)

It will be added with the component.

### 8. Finally add `` in your view template inside the form.

[](#8-finally-add--this-recaptcha-display--in-your-view-template-inside-the-form)

For example:

```

```

See another example of contact with no form in `src/Controller/ContactController.php`, `src/Template/Contact/index.ctp` and `src/Form/ContactForm.php`. You can test it by going to `http://localhost/recaptcha/contact`.

What's inside ?
---------------

[](#whats-inside-)

**COMPONENT**

- RecaptchaComponent

**HELPERS**

- RecaptchaHelper (Automatically added when the RecaptchaComponent is added)

**CONSOLE**

- Installer

**EXAMPLE**

- Controller : ContactController
- Form : ContactForm
- Template : Contact/index.ctp

Tests
-----

[](#tests)

To test the plugin, clone it and run `composer install`. Then run `./vendor/bin/phpunit` and `./vendor/bin/phpcs -n -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests --ignore=vendor`

Support &amp; Contribution
--------------------------

[](#support--contribution)

For support and feature request, please contact me through Github issues

Please feel free to contribute to the plugin with new issues, requests, unit tests and code fixes or new features. If you want to contribute some code, create a feature branch, and send us your pull request. Unit tests for new features and issues detected are mandatory to keep quality high.

License
-------

[](#license)

Copyright (c) \[2014-2015\] \[cake17\]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.9% 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 ~40 days

Recently: every ~70 days

Total

10

Last Release

3807d ago

PHP version history (2 changes)0.1.0PHP &gt;=5.4.16

0.3.0PHP &gt;=5.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/7a43da59c9c660b197642583e11bc825261993aceb3351df6f44f89458628012?d=identicon)[cake17](/maintainers/cake17)

---

Top Contributors

[![cake17](https://avatars.githubusercontent.com/u/1652972?v=4)](https://github.com/cake17 "cake17 (92 commits)")[![javikalsan](https://avatars.githubusercontent.com/u/1070397?v=4)](https://github.com/javikalsan "javikalsan (1 commits)")

---

Tags

googlecakephprecaptchacaptchabootstrap

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cake17-cakephp-recaptcha/health.svg)

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

###  Alternatives

[cakephp-fr/recaptcha

To easily use Google Recaptcha (free CAPTCHA service that protect websites from spam and abuse) in CakePHP projects

1419.3k](/packages/cakephp-fr-recaptcha)[crabstudio/recaptcha

Easily use Google Recaptcha in CakePHP projects

20112.2k1](/packages/crabstudio-recaptcha)[phelium/recaptcha

reCAPTCHA v2 class

4389.4k](/packages/phelium-recaptcha)

PHPackages © 2026

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