2017 © Pedro Peláez
 

library zf2-recaptcha

ReCaptcha v2.0 module for Zend Framework 2 (ZF2)

image

browserlife/zf2-recaptcha

ReCaptcha v2.0 module for Zend Framework 2 (ZF2)

  • Thursday, October 29, 2015
  • by malganis93
  • Repository
  • 2 Watchers
  • 3 Stars
  • 10,318 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 1 Open issues
  • 4 Versions
  • 14 % Grown

The README.md

BrlReCaptcha - A ZF2 Module for Google ReCaptchaV2

Build Status: build status, (*1)

This modules makes it possible to use the new ReCaptcha LINK in your ZendFramework2 (ZF2) projects., (*2)

I created this module, since ZendFrameworkService\ReCaptcha seems to be dead and is still on RCv1., (*3)

Installation

with composer

Just add the following line to your requirements:, (*4)

"browserlife/zf2-recaptcha": "dev-master"

and run, (*5)

php composer.phar update

Since there are problems with the SSL-Cert if you use Adapter\Socket, please install php-curl!, (*6)

Then activate the module in your application.config.php :, (*7)

```php
return array(
    'modules' => array(
        // ...
        'BrlReCaptcha',
    ),
    // ...
);
```

Get your private-key

To use this service, you have to register at Google ReCaptcha using your Google-Account., (*8)

Usage

with Zend\From

This module works similar as ZendFrameworkService\ReCaptcha., (*9)

Just add the following lines to your form creation:, (*10)

$element = new \Zend\Captcha\Captcha('g-recaptcha-response');
$element->setCaptcha(new BrlReCaptcha\ReCaptcha(array('private_key' => 'YOUR_SECRET FROM GOOGLE', 'public_key' => 'YOUR_PUBLIC_KEY', 'theme' => 'dark')));
$form->add($element);

Important: The element has to be named g-recaptcha-response due to the reason that the JS from google creates this virtual input., (*11)

Remember to add this element to your validationChain as well., (*12)

Note: The theme parameter is not required. By default the light theme is used., (*13)

It acts the same way as any other built-in captcha solution., (*14)

with ServiceManager

If you like to implement the view on your own, just use the Service\ReCaptchaService. It handles the whole communication between your code and the ReCaptcha API., (*15)

$recaptcha = $serviceLocator->get('BrlRecaptcha\Service\ReCaptcha');

other

just look into the sources! It's pretty easy to understand., (*16)

TODO

  • PHPUnit Tests are missing -> Will do this in the next couple of days
  • some error handling is qnd
  • better documentation

Questions?

If you have any problems or questions regarding my code, please create an issue. Since i'm using this module for my own projects i'm interested in keeping this up to date!, (*17)

The Versions

29/10 2015

dev-master

9999999-dev https://github.com/malganis93/BrlReCaptcha

ReCaptcha v2.0 module for Zend Framework 2 (ZF2)

  Sources   Download

MIT

The Requires

 

zf2 captcha recaptcha

29/10 2015

v1.0.1

1.0.1.0 https://github.com/malganis93/BrlReCaptcha

ReCaptcha v2.0 module for Zend Framework 2 (ZF2)

  Sources   Download

MIT

The Requires

 

zf2 captcha recaptcha

20/05 2015

dev-dev

dev-dev https://github.com/malganis93/BrlReCaptcha

ReCaptcha v2.0 module for Zend Framework 2 (ZF2)

  Sources   Download

MIT

The Requires

 

zf2 captcha recaptcha

09/05 2015

v1.0

1.0.0.0 https://github.com/malganis93/BrlReCaptcha

ReCaptcha v2.0 module for Zend Framework 2 (ZF2)

  Sources   Download

MIT

The Requires

 

zf2 captcha recaptcha