developit/yii2-captcha

yii2 captcha

Installs: 15 644

Dependents: 0

Suggesters: 0

Security: 0

Stars: 9

Watchers: 3

Forks: 2

Open Issues: 0

Type:yii2-extension

1.2 2017-09-05 17:50 UTC

This package is not auto-updated.

Last update: 2024-04-17 16:21:03 UTC


README

yii2 captcha with Ability to recognize Arabic and Persian numbers.

screenshot

Installation

The preferred way to install this extension is through composer.

Either run

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

or add

"developit/yii2-captcha": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply modify your controler, add or change methode actions():

    public function actions()
    {
        $this->layout = $this->setting['layout'];
        return [
            'error' => [
                'class' => 'yii\web\ErrorAction',
            ],
            'captcha' => [
                'class' => 'developit\captcha\CaptchaAction',
                'type' => 'numbers', // 'numbers', 'letters' or 'default' (contains numbers & letters)
                'minLength' => 4,
                'maxLength' => 4,
            ],
        ];
    }

In view

use developit\captcha\Captcha;
<?=
$form->field($model, 'verifyCode')->widget(Captcha::className())
?>