PHP code example of integready / yii2-simplemath-captcha

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

    

integready / yii2-simplemath-captcha example snippets


public function actions()
{
	return [
            ...
            'captcha' => [
                'class' => 'integready\simplemathcaptcha\CaptchaAction',
                'operators' => ['+','-','*'],
                'maxValue' => 10,
                'fontSize' => 18,
            ],
	];
}

<?=
$form->field($model, 'verifyCode')->widget(Captcha::className(), [
    'template' => '<div class="row"><div class="col-lg-2">{image}</div><div class="col-lg-10">{input}</div></div>',
])->hint('Hint: click on the equation to refresh')

'rules' => [
    'site/captcha/<refresh:\d+>' => 'site/captcha',
    'site/captcha/<v:\w+>' => 'site/captcha',
]