dev-master
9999999-dev http://reklamper.comYii captcha package
MIT
The Requires
- php >=5.3.0
by Kozitsin Konstantin
captcha yii
Yii captcha package
Try out demonstration., (*1)
Extract files from archive to folder: ext.reklamperCaptcha
, (*2)
In model declare attribute and add validation rules:, (*3)
class Comments extends CActiveRecord { public $reklamperCaptcha; public function rules() { return array_merge( parent::rules(), array( array('reklamperCaptcha','required',), array('reklamperCaptcha','ext.reklamperCaptcha.ReklamperCaptchaValidator', // custom error message: 'message' => 'Validation code is incorrect', ), )); } // other functions }
in view file show widget:, (*4)
widget( 'ext.reklamperCaptcha.ReklamperCaptcha', array( 'model' => $model, 'attribute' => 'reklamperCaptcha', // its attribute name ) ); //and error message echo CHtml::error($model,'parrotifyCaptcha'); ?>
Add package to composer.json
:, (*5)
"reklamper/yii-reklampercaptcha": "dev-master"
Add vendor
alias into /index.php
:, (*6)
... $vendorPath = ABSOLUTE_PATH_TO_COMPOSER.'/vendor'); Yii::setPathOfAlias('vendor', $vendorPath); ...
In model declare attribute and add validation rules:, (*7)
array('reklamperCaptcha','vendor.reklamper.yii-reklampercaptcha.ReklamperCaptchaValidator', // custom error message: 'message' => 'Validation code is incorrect', ),
in view file show widget:, (*8)
<?php // summon widget $this->widget( 'vendor.reklamper.yii-reklampercaptcha.ReklamperCaptcha', array( 'model' => $model, 'attribute' => 'reklamperCaptcha', // its attribute name ) ); //and error message echo CHtml::error($model,'reklamperCaptcha'); ?>
Yii captcha package
MIT
captcha yii