sfue/re-captcha-bundle

Google reCAPTCHA symfony form type and validator

v1.0.1 2018-05-13 21:41 UTC

This package is not auto-updated.

Last update: 2024-04-28 03:30:44 UTC


README

Installation

Install the bundle via composer

$ composer require sfue/re-captcha-bundle

Add the Bundle to your AppKernel

// app/AppKernel.php

<?php

public function registerBundles()
{
    $bundles = array(
        // ...
        new new Sfue\ReCaptchaBundle\SfueReCaptchaBundle(),
    );
}

Add the bundles form theme to your twig configuration

sfue_re_captcha:
    site_key: 'your Google reCAPTCHA site key'
    secret: 'your Google reCAPTCHA secret'

Add the bundles form theme to your twig configuration

# Twig Configuration
twig:
    form_themes:
        - '@SfueReCaptcha/Form/fields.html.twig'

Use the ReCaptchaType in any form you want to have a reCAPTCHA field

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