2017 © Pedro Peláez
 

symfony-bundle symfony2recaptcha

This bundle provides easy reCAPTCHA form field integration

image

salberts/symfony2recaptcha

This bundle provides easy reCAPTCHA form field integration

  • Saturday, August 1, 2015
  • by salberts
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 14 Versions
  • 0 % Grown

The README.md

EWZRecaptchaBundle

This bundle provides easy reCAPTCHA form field for Symfony., (*1)

A bridge for the Silex framework has been implemented too : Jump to documentation., (*2)

Installation

Step 1: Use composer and enable Bundle

To install EWZRecaptchaBundle with Composer just add the following to your composer.json file:, (*3)

// composer.json
{
    // ...
    "require": {
        // ...
        "excelwebzone/recaptcha-bundle": "dev-master"
    }
}

NOTE: Please replace dev-master in the snippet above with the latest stable branch, for example 2.3.*., (*4)

Then, you can install the new dependencies by running Composer's update command from the directory where your composer.json file is located:, (*5)

$ php composer.phar update

Now, Composer will automatically download all required files, and install them for you. All that is left to do is to update your AppKernel.php file, and register the new bundle:, (*6)

add('recaptcha', 'ewz_recaptcha');
    // ...
}
```

You can pass extra options to reCAPTCHA with the "attr > options" option:

``` php
add('recaptcha', 'ewz_recaptcha', array(
        'attr' => array(
            'options' => array(
                'theme' => 'light',
                'type'  => 'image'
            )
        )
    ));
    // ...
}
```

To validate the field use:

``` php
false``` then the annotation will not work. You have to also set ```constraints```:

``` php
add('recaptcha', 'ewz_recaptcha', array(
        'attr'        => array(
            'options' => array(
                'theme' => 'light',
                'type'  => 'image'
            )
        ),
        'mapped'      => false,
        'constraints' => array(
            new RecaptchaTrue()
        )
    ));
    // ...
```


The form template resource is now auto registered via an extension of the container.
However, you can always implement your own custom form widget.

**PHP**:

``` php
setTheme($form, array('EWZRecaptchaBundle:Form')) ?>

widget($form['recaptcha'], array(
    'attr' => array(
        'options' => array(
            'theme' => 'light',
            'type'  => 'image'
        ),
    ),
)) ?>

Twig:, (*7)

``` jinja {% form_theme form 'EWZRecaptchaBundle:Form:ewz_recaptcha_widget.html.twig' %}, (*8)

{{ form_widget(form.recaptcha, { 'attr': { 'options' : { 'theme': 'light', 'type': 'image' }, } }) }}, (*9)


If you are not using a form, you can still implement the reCAPTCHA field using JavaScript: **PHP**: ``` php <div id="recaptcha-container"></div> <script type="text/javascript"> $(document).ready(function() { $.getScript("<?php echo \EWZ\Bundle\RecaptchaBundle\Form\Type\RecaptchaType::RECAPTCHA_API_JS_SERVER ?>", function() { Recaptcha.create("<?php echo $form['recaptcha']->get('public_key') ?>", "recaptcha-container", { theme: "clean", }); }); }; </script>

Twig:, (*10)

``` jinja , (*11)


## Customization If you want to use a custom theme, put your chunk of code before setting the theme: ``` jinja
Incorrect please try again
Enter the words above: Enter the numbers you hear:
{% form_theme form 'EWZRecaptchaBundle:Form:ewz_recaptcha_widget.html.twig' %} {{ form_widget(form.recaptcha, { 'attr': { 'options' : { 'theme' : 'custom', }, } }) }}

Further reading: Customizing the Look and Feel of reCAPTCHA, (*12)

The Versions

01/08 2015

dev-master

9999999-dev https://github.com/salberts/symfony2recaptcha

This bundle provides easy reCAPTCHA form field integration

  Sources   Download

MIT

The Requires

 

recaptcha

01/08 2015

v1.4.7

1.4.7.0 https://github.com/salberts/symfony2recaptcha

This bundle provides easy reCAPTCHA form field integration

  Sources   Download

MIT

The Requires

 

recaptcha

01/08 2015

v1.4.6

1.4.6.0 https://github.com/salberts/symfony2recaptcha

This bundle provides easy reCAPTCHA form field integration

  Sources   Download

MIT

The Requires

 

recaptcha

01/08 2015

v1.4.5

1.4.5.0 https://github.com/salberts/symfony2recaptcha

This bundle provides easy reCAPTCHA form field integration

  Sources   Download

MIT

The Requires

 

recaptcha

01/08 2015

v1.4.4

1.4.4.0 https://github.com/salberts/symfony2recaptcha

This bundle provides easy reCAPTCHA form field integration

  Sources   Download

MIT

The Requires

 

recaptcha2

01/08 2015

v1.4.3

1.4.3.0 https://github.com/salberts/symfony2recaptcha

This bundle provides easy reCAPTCHA form field integration

  Sources   Download

MIT

The Requires

 

recaptcha2

01/08 2015

1.0.x-dev

1.0.9999999.9999999-dev https://github.com/salberts/symfony2recaptcha

This bundle provides easy reCAPTCHA form field integration

  Sources   Download

MIT

The Requires

 

recaptcha2

01/08 2015

v1.4.2

1.4.2.0 https://github.com/salberts/symfony2recaptcha

This bundle provides easy reCAPTCHA form field integration

  Sources   Download

MIT

The Requires

 

recaptcha2

01/08 2015

v1.4.1

1.4.1.0 https://github.com/excelwebzone/EWZRecaptchaBundle

This bundle provides easy reCAPTCHA form field integration

  Sources   Download

MIT

The Requires

 

recaptcha

08/07 2015

v1.4.0

1.4.0.0 https://github.com/excelwebzone/EWZRecaptchaBundle

This bundle provides easy reCAPTCHA form field integration

  Sources   Download

MIT

The Requires

 

recaptcha

21/05 2015

v1.3.0

1.3.0.0 https://github.com/excelwebzone/EWZRecaptchaBundle

This bundle provides easy reCAPTCHA form field integration

  Sources   Download

MIT

The Requires

 

recaptcha

01/04 2015

v1.2.0

1.2.0.0 https://github.com/excelwebzone/EWZRecaptchaBundle

This bundle provides easy reCAPTCHA form field integration

  Sources   Download

MIT

The Requires

 

recaptcha

20/11 2014

v1.1.0

1.1.0.0 https://github.com/excelwebzone/EWZRecaptchaBundle

This bundle provides easy reCAPTCHA form field integration

  Sources   Download

MIT

The Requires

 

recaptcha

02/09 2013

v1.0.0

1.0.0.0 https://github.com/excelwebzone/EWZRecaptchaBundle

This bundle provides easy reCAPTCHA form field integration

  Sources   Download

MIT

The Requires

 

recaptcha