Protects the forms from spam using "honeypot" method
The preferred way to install this extension is through composer.
Use composer
composer require --prefer-dist elmnsk/yii2-honeypot "*"
or add
"elmnsk/yii2-honeypot": "*"
to the require section of your composer.json
file.
Once the extension is installed, simply use it in your code by :
//model property
public $honeypotTime;
//in model rules
['honeypotTime',\elmnsk\yii2honeypot\HoneypotTimeValidator::class,'time'=>10];
<?=$form->field($model,'honeypotTime')
->widget(\elmnsk\yii2honeypot\HoneypotTimeWidget::class)->label(false);?>
'time' - this is the time in seconds, less than which the form submission will be detected as spam
No stable releases.
Comments