2017 © Pedro Peláez
 

symfony-bundle googlerecaptchabundle

Google reCATPCHA form type and validator

image

emmanuelballery/googlerecaptchabundle

Google reCATPCHA form type and validator

  • Monday, August 14, 2017
  • by emmanuelballery
  • Repository
  • 1 Watchers
  • 1 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

GoogleRecaptchaBundle

Google reCAPTCHA form type for Symfony., (*1)

https://www.google.com/recaptcha/intro/invisible.html, (*2)

Configuration

google_recaptcha:

    site_key: ~
    secret_key: ~

    # following configuration is optional

    api_endpoint: 'https://www.google.com/recaptcha/api/siteverify'
    form_field_name: 'g-recaptcha-response'

Usage

In your Symfony form type:, (*3)

use GoogleRecaptchaBundle\Form\Type\GoogleRecaptchaType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

class ContactType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            // ...
            ->add('recaptcha', GoogleRecaptchaType::class);
    }
}

Form theme

Use the google_recaptcha identifier to theme your form field., (*4)

{% block google_recaptcha_row %}
    <div class="hide">{{ block('form_label') }}</div>
    {{ block('form_widget') }}
    {{ block('form_errors') }}
{% endblock %}

The Versions

14/08 2017

dev-master

9999999-dev

Google reCATPCHA form type and validator

  Sources   Download

MIT

The Requires