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

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

crabstudio/recaptcha
====================

Easily use Google Recaptcha in CakePHP projects

4.1.0(1y ago)20112.2k—8.3%171MITPHPPHP &gt;=8.1CI passing

Since Dec 8Pushed 1y ago2 watchersCompare

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

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

[![Build Status](https://camo.githubusercontent.com/8aa90c97aeb9d7467b8ddc248cae321d290b81dbc946e56b52aca12bc8a71155/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f63746c6162766e2f5265636170746368612f63692e796d6c3f6272616e63683d6d6173746572)](https://github.com/ctlabvn/Recaptcha/actions/workflows/ci.yml?query=branch%3Amaster)[![Latest Stable Version](https://camo.githubusercontent.com/7a676594b0eb53ee6930026bc754569ef8f244845233b2df43e4469fb9d019b2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6372616273747564696f2f726563617074636861)](https://packagist.org/packages/crabstudio/recaptcha)[![Total Downloads](https://camo.githubusercontent.com/df8ab9d60e4970f09c886e7a3a33d518906f052229c874be769cb81f79a05146/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6372616273747564696f2f726563617074636861)](https://packagist.org/packages/crabstudio/recaptcha)[![License](https://camo.githubusercontent.com/2e608ab0101a035ece62d2486a644990665bb10f7d5c83bb706ff5a830e09fab/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f63746c6162766e2f526563617074636861)](https://github.com/ctlabvn/Recaptcha/blob/master/LICENSE)

Integrate Google Recaptcha v2 to your CakePHP project
=====================================================

[](#integrate-google-recaptcha-v2-to-your-cakephp-project)

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

[](#installation)

You can install this plugin into your CakePHP application using [composer](http://getcomposer.org).

The recommended way to install composer packages is:

```
composer require crabstudio/recaptcha
```

Load plugin
-----------

[](#load-plugin)

From command line:

```
bin/cake plugin load Recaptcha
```

Load Component and Configure
----------------------------

[](#load-component-and-configure)

Override default configure from loadComponent:

```
$this->loadComponent('Recaptcha.Recaptcha', [
    'enable' => true,     // true/false
    'sitekey' => 'your_site_key', //if you don't have, get one: https://www.google.com/recaptcha/intro/index.html
    'secret' => 'your_secret',
    'type' => 'image',  // image/audio
    'theme' => 'light', // light/dark
    'lang' => 'en', // default 'en'
    'size' => 'normal'  // normal/compact
    'callback' => null, // `callback` data attribute for the recaptcha div, default `null`
    'scriptBlock' => true // Value for `block` option for HtmlHelper::script() call
]);
```

Override default config from app config file:

```
// file: config/app.php

    /**
     * Recaptcha configuration.
     */
    'Recaptcha' => [
        'sitekey' => 'your_site_key',
        'secret' => 'your_secret',
        'type' => 'image',
        'theme' => 'light',
        'lang' => 'es',
        'size' => 'normal'
    ]
```

Override default configure from recaptcha config file:

```
// file: config/recaptcha.php

return [
    /**
     * Recaptcha configuration.
     *
     */
    'Recaptcha' => [
        'enable' => true,
        'sitekey' => 'your_site_key',
        'secret' => 'your_secret',
        'type' => 'image',
        'theme' => 'light',
        'lang' => 'es',
        'size' => 'normal'
    ]
];
```

Load recaptcha config file:

```
// file: config/bootstrap.php

    Configure::load('recaptcha', 'default', true);
```

Config preference:

1. loadComponent config options
2. recaptcha config file
3. app config file

Usage
-----

[](#usage)

Display recaptcha in your template:

```
