Statistics
15816
14
3
85d
Badges
Dependencies

reCAPTCHA

Google reCAPTCHA implementation for Nette Framework forms.


Build Status Code coverage HHVM Status Licence

Downloads this Month Downloads total Latest stable Latest unstable

Discussion / Help

Join the chat

Versions

Branch Composer Nette PHP Readme
master dev-master 2.4 >=5.6 -
latest ^2.0.0 2.4 >=5.6 -
1.6.x ^1.6.3 2.4 >=5.6 README-1.6
1.5.x ^1.5.2 2.3 >=5.4 README-1.5
1.4.x ^1.4.4 2.2 >=5.4 README-1.4
1.3.x ^1.3.0 2.1 >=5.4 README-1.3

Pre-installation

Add your site to the sitelist in reCAPTCHA administration.

reCAPTCHA

Installation

The latest version is most suitable for Nette ~2.4.0 and PHP >=5.6.

composer require minetro/recaptcha:^2.0.0

Configuration

extensions:
    recaptcha: Minetro\ReCaptcha\DI\ReCaptchaExtension

recaptcha:
    secretKey: ***
    siteKey: ***

Usage

use Nette\Application\UI\Form;

protected function createComponentForm() 
{
    $form = new Form();
    
    $form->addReCaptcha('recaptcha', $label = 'Captcha')
        ->setMessage('Are you bot?');
    
    $form->addReCaptcha('recaptcha', $label = 'Captcha', $required = FALSE)
        ->setMessage('Are you bot?');
    
    $form->addReCaptcha('recaptcha', $label = 'Captcha', $required = TRUE, $message = 'Are you bot?');
    
    $form->onSuccess[] = function($form) {
        dump($form->getValues());
    }
}

Rendering

<form n:name="myForm">
	<div class="form-group">
		<div n:name="recaptcha"></div>
	</div>
</form>

Be sure you place this script before </body> element.

<!-- re-Captcha -->
<script src='https://www.google.com/recaptcha/api.js'></script>
  • 2.0.1 v2.0.1

    Bumped! 🌫

    Changes:

    • fix call setRequired(TRUE | FALSE) [thanks @sallyx][#9][#10]
  • 2.0.0 v2.0.0

    Bumped! Bump, bump, bump. 🤛

    Changes:

    • completely changed internal API
    • major simplification
    • changed namespaces
    • PHP >=5.6
  • 1.6.3 v1.6.3

    Bumped! 🕳 🔪

    Changes:

    • fix obtaining IReCaptchaValidatorFactory
  • 1.5.2 v1.5.2

    Bumped! 🕳

    Changes:

    • fix obtaining IReCaptchaValidatorFactory
  • 1.6.2 v1.6.2

    Bump! 🏈

    Fixes:

    • bug in ReCaptchaExtension (#5)
  • 1.4.4 v1.4.4

    Bump! 🇯🇴

    • fixed support Nette ~2.2.0
  • 1.6.0 v1.6.0

    Bumped! 👾

    • Fixed Nette serie ~2.3.
    • This is last release for Nette 2.3.
  • 1.5.1 v1.5.1

    🍔 v1.5.1

    • Change addClass -> class (ae94b64)
    • More examples in README

Is this addon outdated? Did you find an issue? Please report it.

Componette Componette admin@componette.com