PHP code example of yamilovs / color-captcha-bundle

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

    

yamilovs / color-captcha-bundle example snippets



// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Yamilovs\ColorCaptchaBundle\YamilovsColorCaptchaBundle(),
    );
}


// src/FooBundle/Form/Type/BarType.php

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Yamilovs\ColorCaptchaBundle\Form\Type\ColorCaptchaType;

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

class FooType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
        {
            $builder
                ->add('captcha', ColorCaptchaType::class, [
                    'help_text_position' => 'top',
                ])
            ;
        }
}
 bash
$ php composer.phar