2017 © Pedro Peláez
 

yii2-module yiirbacp

Simple captcha for yii2.Just add the module in config file and use the widget.

image

myzero1/yiirbacp

Simple captcha for yii2.Just add the module in config file and use the widget.

  • Thursday, November 30, 2017
  • by myzero1
  • Repository
  • 0 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

yii2-rbacp

Simple captcha for yii2.Just add the module in config file and use the widget., (*1)

Installation

The preferred way to install this module is through composer., (*2)

Either run, (*3)

php composer.phar require myzero1/yii2-captcha:1.*

or add, (*4)

"myzero1/yii2-captcha": "~1"

to the require section of your composer.json file., (*5)

Setting

Once the extension is installed, simply modify your application configuration as follows:, (*6)

return [
    // ...
    'bootstrap' => ['captcha',...],
    'modules' => [
        'captcha' => [
            'class' => 'myzero1\captcha\Module',
            // 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
            // 'backColor' => 0x605ca8,//背景颜色
            // 'maxLength' => 3, //最大显示个数
            // 'minLength' => 3,//最少显示个数
            // 'padding' => 5,//间距
            // 'height' => 40,//高度
            // 'width' => 80,  //宽度
            // 'foreColor' => 0xffffff,     //字体颜色
            // 'offset' => 4,        //设置字符偏移量 有效果
            // 'transparent' => false,        //设置字符偏移量 有效果
        ],
        // ...
    ],
    // ...
];

Usage

Add upload widget like following:, (*7)


echo \myzero1\captcha\widgets\Captcha::widget([ 'model' => new \myzero1\captcha\models\Captcha(['scenario'=>'js']), // 'model' => new \myzero1\captcha\models\Captcha(['scenario'=>'jsPhp']), 'attribute' => 'verifyCode', 'imageOptions'=>[ 'alt'=>'点击换图', 'title'=>'点击换图', 'style'=>'cursor:pointer' ] ]);

With ActiveForm, (*8)


echo $form // ->field(new \myzero1\captcha\models\Captcha(['scenario'=>'php']),'verifyCode') ->field(new \myzero1\captcha\models\Captcha(['scenario'=>'jsPhp']),'verifyCode') ->widget( myzero1\captcha\widgets\Captcha::className(), [ 'imageOptions'=>[ 'alt'=>'点击换图', 'title'=>'点击换图', 'style'=>'cursor:pointer' ] ] )

The scenario discretion - php: Just validate by PHP. - jsPhp: validate by JS and PHP, (*9)

You can access Demo through the following URL:, (*10)

http://localhost/path/to/index.php?r=captcha/default/demo

or if you have enabled pretty URLs, you may use the following URL:, (*11)

http://localhost/path/to/index.php/captcha/default/demo

The Versions

30/11 2017

dev-master

9999999-dev

Simple captcha for yii2.Just add the module in config file and use the widget.

  Sources   Download

MIT

The Requires

 

by Xuanwu Qin

30/11 2017

dev-develop

dev-develop

Simple captcha for yii2.Just add the module in config file and use the widget.

  Sources   Download

MIT

The Requires

 

by Xuanwu Qin