PHP code example of gremo / captcha-form-bundle

1. Go to this page and download the library: Download gremo/captcha-form-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/ */

    

gremo / captcha-form-bundle example snippets



// config/bundles.php

return [
    // ...
    Gremo\CaptchaFormBundle\GremoCaptchaFormBundle::class => ['all' => true],
];


// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Gremo\CaptchaFormBundle\GremoCaptchaFormBundle(),
    );
}

// For Symfony >= 2.8 and PHP >= 5.5 use the class name resolution via ::class
use Gremo\CaptchaFormBundle\Form\Type\CaptchaType;

$builder->add('captcha', CaptchaType::class, [
    // Pass custom options to override defaults from configuration
]);

// For Symfony >= 2.8 and PHP < 5.5 use the fully-qualified class name as string
$builder->add('captcha', 'Gremo\CaptchaFormBundle\Form\Type\CaptchaType', [
    // Pass custom options to override defaults from configuration
]);

// For Symfony < 2.8
$builder->add('captcha', 'gremo_captcha', [
    // Pass custom options to override defaults from configuration
]);

// For Symfony >= 2.8 and PHP >= 5.5 use the class name resolution via ::class
use Gremo\CaptchaFormBundle\Form\Type\RecaptchaType;

$builder->add('captcha', RecaptchaType::class, [
    // Pass custom options to override defaults from configuration
]);

// For Symfony >= 2.8 and PHP < 5.5 use the fully-qualified class name as string
$builder->add('captcha', 'Gremo\CaptchaFormBundle\Form\Type\RecaptchaType', [
    // Pass custom options to override defaults from configuration
]);

// For Symfony < 2.8
$builder->add('captcha', 'gremo_captcha_recaptcha', [
    // Pass custom options to override defaults from configuration
]);

// For Symfony >= 2.8 and PHP >= 5.5 use the class name resolution via ::class
use Gremo\CaptchaFormBundle\Form\Type\RecaptchaV3Type;

$builder->add('captcha', RecaptchaV3Type::class, [
    // For options
]);

// For Symfony >= 2.8 and PHP < 5.5 use the fully-qualified class name as string
$builder->add('captcha', 'Gremo\CaptchaFormBundle\Form\Type\RecaptchaV3Type', [
    // For options
]);

// For Symfony < 2.8
$builder->add('captcha', 'gremo_captcha_recaptcha_v3', [
    // For options
]);

// For Symfony >= 2.8 and PHP >= 5.5 use the class name resolution via ::class
use Gremo\CaptchaFormBundle\Form\Type\GregwarCaptchaType;

$builder->add('captcha', GregwarCaptchaType::class, [
    // Pass custom options to override defaults from configuration
]);

// For Symfony >= 2.8 and PHP < 5.5 use the fully-qualified class name as string
$builder->add('captcha', 'Gremo\CaptchaFormBundle\Form\Type\GregwarCaptchaType', [
    // Pass custom options to override defaults from configuration
]);

// For Symfony < 2.8
$builder->add('captcha', 'gremo_captcha_gregwar', [
    // Pass custom options to override defaults from configuration
]);

// For Symfony >= 2.8 and PHP >= 5.5 use the class name resolution via ::class
use Gremo\CaptchaFormBundle\Form\Type\HoneypotType;

$builder->add('captcha', HoneypotType::class, [
    // Pass custom options to override defaults from configuration
]);

// For Symfony >= 2.8 and PHP < 5.5 use the fully-qualified class name as string
$builder->add('captcha', 'Gremo\CaptchaFormBundle\Form\Type\HoneypotType', [
    // Pass custom options to override defaults from configuration
]);

// For Symfony < 2.8
$builder->add('captcha', 'gremo_captcha_honeypot', [
    // Pass custom options to override defaults from configuration
]);