PHPackages                             lesha724/yii2-math-captcha - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. lesha724/yii2-math-captcha

ActiveYii2-extension[Authentication &amp; Authorization](/categories/authentication)

lesha724/yii2-math-captcha
==========================

mathСaptcha in yii2

v0.1.2(8y ago)28.8k↓23.3%12MITPHP

Since Aug 18Pushed 8y ago1 watchersCompare

[ Source](https://github.com/lesha724/yii2-math-captcha)[ Packagist](https://packagist.org/packages/lesha724/yii2-math-captcha)[ RSS](/packages/lesha724-yii2-math-captcha/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (2)

math-captcha
============

[](#math-captcha)

виджет math-captcha

[![Пример](https://raw.githubusercontent.com/lesha724/yii2-math-captcha/master/img/example.PNG)](https://raw.githubusercontent.com/lesha724/yii2-math-captcha/master/img/example.PNG)

Установка
---------

[](#установка)

Предпочтительным способом установки этого расширения является [composer](http://getcomposer.org/download/).

Выполните

```
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
            ],
        ];
    }
}
```

```

....
