PHP code example of gonzakpo / recaptcha-bundle

1. Go to this page and download the library: Download gonzakpo/recaptcha-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gonzakpo / recaptcha-bundle example snippets


// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new Pv\RecaptchaBundle\PvRecaptchaBundle(),
        // ...
    );
}

public function buildForm(FormBuilderInterface $builder, array $options)
{
    $builder
        // ...
        ->add('recaptcha', 'pv_recaptcha', array(
            'label' => 'Your label',
            'mapped' => false,
        ))
        // ...
    ;
}

public function buildForm(FormBuilderInterface $builder, array $options)
{
    $builder
        // ...
        ->add('recaptcha', 'pv_recaptcha', array(
            'label' => false,
            'mapped' => false,
            'invisible' => true,
            'form_id' => 'your-form-element-id'
        ))
        // ...
    ;
}
twig
    {{ form_label(form.recaptcha) }}
    {{ form_widget(form.recaptcha) }}
    {{ form_errors(form.recaptcha) }}