Skip to content

elmnsk/yii2-honeypot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Honeypot time extension for Yii2

Protects the forms from spam using "honeypot" method

Installation

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.

Usage

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

Releases

No releases published

Packages

No packages published

Languages