2017 © Pedro Peláez
 

symfony-bundle wixet-recaptcha-bundle

This Bundle provides support for google recaptcha into symfony forms

image

maxpowel/wixet-recaptcha-bundle

This Bundle provides support for google recaptcha into symfony forms

  • Tuesday, February 21, 2017
  • by maxpowel
  • Repository
  • 1 Watchers
  • 0 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

WixetRecaptchaBundle

Build Status Coverage Status License, (*1)

Add google captcha validation to symfony forms easily, (*2)

Installation

Step 1: Use composer and enable Bundle

To install WixetRecaptchaBundle with Composer just type in your terminal:, (*3)

composer require maxpowel/wixet-recaptcha-bundle

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:, (*4)

<?php

// in AppKernel::registerBundles()
$bundles = array(
    // ...
    new Wixet\RecaptchaBundle\WixetRecaptchaBundle(),
    // ...
);

Step2: Configure the bundle's

Add the following to your config file:, (*5)

``` yaml wixet_recaptcha: site_key: "YourSiteKey" secret: "YourSecret", (*6)

Get your recaptcha keys at [https://www.google.com/recaptcha/admin](https://www.google.com/recaptcha/admin)

## Basic Usage

In your controller or wherever is your form, add the WixetRecaptchaType like the following example:
```php

$form = $this->createFormBuilder()
            ->add("name", TextType::class)
            ->add("recaptcha", WixetRecaptchaType::class)
            ->add("Submit", SubmitType::class)
            ->getForm()
        ;

Don't forget to include the type, (*7)

use Wixet\RecaptchaBundle\Form\Type\WixetRecaptchaType;

Multiple and delayed rendering

Sometimes you need multiple recaptchas or delayed render (not render onload but render when you want). This is useful for example when you load ajax content with recaptchas., (*8)

The first step is include the recaptcha script manually (where you load all your scripts), you have to options:, (*9)

{{ include_recaptcha() | raw }}

or, (*10)

{{ include('WixetRecaptchaBundle::recaptcha_explicit.html.twig', { 'site_key': recaptcha_site_key() }) }}

I prefer the first way but the second allows more customization., (*11)

Now render the form as usual but with the option "explicit_render=true", (*12)


$form = $this->createFormBuilder() ->add("name", TextType::class) ->add("recaptcha", WixetRecaptchaType::class, array( 'explicit_render' => true )) ->add("Submit", SubmitType::class) ->getForm() ;

That's all!, (*13)

The Versions

21/02 2017

dev-master

9999999-dev

This Bundle provides support for google recaptcha into symfony forms

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alvaro Garcia

form validation recaptcha

21/02 2017

v1.1

1.1.0.0

This Bundle provides support for google recaptcha into symfony forms

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alvaro Garcia

form validation recaptcha

17/02 2017

v1.0

1.0.0.0

This Bundle provides support for google recaptcha into symfony forms

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alvaro Garcia

form validation recaptcha