donate Buy us a cup of coffee
Our service is free. But your donation can help us keep running. To rent a server and domain, to buy us a cup of coffee, to reduce our activity in paid stuff and make this service better. You can send us a donation to BCA Bank, 008 090 8440 in the name of Abdul Malik Ikhsan with Swifcode CENAIDJA. Please confirm to samsonasik@gmail.com after that ;).
download Download module      



Form with Captcha in ZF2 demo


Please type this word BACKWARDS q4cav

This demo show you how to use ZF2 Captcha Form Element, There are 4 adapters:

We currently demoing only 3 (Dumb, Figlet, and Image).

For Dump adapter, we can setup the captcha element like the following:

    
        $this->add([
                'type' => 'Zend\Form\Element\Captcha',
                'name' => 'captcha',
                'options' => [
                    'label' => 'Please type this word BACKWARDS',
                    'captcha' => [
                        'class'   => 'Dump',
                        'options' => [],
                    ],
                ],
        ]);
    

For Figlet adapter, we can setup the captcha element like the following:

    
        $this->add([
                'type' => 'Zend\Form\Element\Captcha',
                'name' => 'captcha',
                'options' => [
                    'label' => 'Please verify you are human.',
                    'captcha' => [
                        'class'   => 'Figlet',
                        'options' => [
                            'outputWidth' => 80,
                            'wordLen' => 7,
                        ],
                    ],
                ],
        ]);
    

For Image adapter, we can setup the captcha element like the following:

    
        $this->add([
                'type' => 'Zend\Form\Element\Captcha',
                'name' => 'captcha',
                'options' => [
                    'label' => 'Please verify you are human.',
                    'captcha' => [
                        'class'   => 'Image',
                        'options' => [
                            'font' => __DIR__ . '/../assets/fonts/arial.ttf',
                            'width' => 200,
                            'height' => 100,
                            'dotNoiseLevel' => 40,
                            'lineNoiseLevel' => 3,
                            'imgDir' => '/path/to/image/captcha/will/be/generated'
                        ],
                    ],
                ],
        ]);
    

By the way, you can find other examples using Zend Framework 2 in our home page :)