lesha724/yii2-math-captcha mathСaptcha in yii2

extensioncaptchawidgetmath-captcha

math-captcha

виджет math-captcha

Пример

Установка

Предпочтительным способом установки этого расширения является composer.

Выполните

php composer.phar require --prefer-dist lesha724/yii2-math-captcha "*"

или добавьте

"lesha724/yii2-math-captcha": "*"

в блок require в вашем composer.json файле.

Использование

Как только расширение будет установлено, просто используйте его в своем коде :

use yii\web\Controller;

class SiteController extends Controller
{
    public function actions()
    {
        return [
            ...
            'captcha' => [
                'class' => 'lesha724\MathCaptcha\MathCaptchaAction',
                //'imageLibrary'=>'imagick', only 'gd' and 'imagick' 
                'fixedVerifyCode' => YII_ENV_TEST ? '42' : null,
                //не задавайте значение foreColor и backColor (они заполняться случайными цветами)
                //остльные опции http://www.yiiframework.com/doc-2.0/yii-captcha-captchaaction.html
            ],
        ];
    }
}

<?php $form = ActiveForm::begin([]); ?>

....

<?= $form->field($model, 'verifyCode')->widget(\yii\captcha\Captcha::className(), [
    'template' => '{image} {input}',
]) ?>

....

<?php ActiveForm::end(); ?>

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

Comments



v0.1.2 is the latest of 3 releases



MIT license
Stats
2 github stars & 1 github forks
3 downloads in the last day
74 downloads in the last 30 days
4182 total downloads