dev-master
9999999-dev http://parrotify.comYii captcha package
MIT
The Requires
- php >=5.3.0
by Kozitsin Konstantin
captcha yii
Wallogit.com
2017 © Pedro Peláez
Yii captcha package
Try out demonstration., (*1)
Extract files from archive to folder: ext.parrotifyCaptcha, (*2)
In model declare attribute and add validation rules:, (*3)
class Comments extends CActiveRecord
{
public $parrotifyCaptcha;
public function rules()
{
return array_merge( parent::rules(), array(
array('parrotifyCaptcha','required',),
array('parrotifyCaptcha','ext.parrotifyCaptcha.ParrotifyCaptchaValidator',
// custom error message:
'message' => 'Validation code is incorrect',
),
));
}
// other functions
}
in view file show widget:, (*4)
widget( 'ext.parrotifyCaptcha.ParrotifyCaptcha', array( 'model' => $model, 'attribute' => 'parrotifyCaptcha', // its attribute name ) ); //and error message echo CHtml::error($model,'parrotifyCaptcha'); ?>
Add package to composer.json:, (*5)
"parrotify/yii-parrotifycaptcha": "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('parrotifyCaptcha','vendor.parrotify.yii-parrotifycaptcha.ParrotifyCaptchaValidator',
// custom error message:
'message' => 'Validation code is incorrect',
),
in view file show widget:, (*8)
<?php
// summon widget
$this->widget(
'vendor.parrotify.yii-parrotifycaptcha.ParrotifyCaptcha',
array(
'model' => $model,
'attribute' => 'parrotifyCaptcha', // its attribute name
)
);
//and error message
echo CHtml::error($model,'parrotifyCaptcha');
?>
Yii captcha package
MIT
captcha yii