cleantalk / yii-antispam
Anti-spam yii extension by CleanTalk with protection against spam bots and manual spam.
Installs: 1 437
Dependents: 0
Suggesters: 0
Security: 0
Stars: 15
Watchers: 5
Forks: 4
Open Issues: 0
Type:yii-extension
pkg:composer/cleantalk/yii-antispam
Requires
- php: >=5.3.0
- yiisoft/yii: 1.1.*
Requires (Dev)
- phpunit/phpunit: ~4.1
This package is auto-updated.
Last update: 2025-10-04 13:52:31 UTC
README
##Yii-antispam Anti-spam by CleanTalk extension with protection against spam bots and manual spam.
No Captcha, no questions, no counting animals, no puzzles, no math.
Requirements
- Yii 1.1 or above
- CleanTalk account https://cleantalk.org/register?product=anti-spam
##Usage
- 
Get access key on https://cleantalk.org/register?platform=yii 
- 
Extract content from archive under protected/extensions/yii-antispam 
- 
Open your application configuration in protected/config/main.php and modify components section: 
// application components
'components'=>array(
    ...
        'cleanTalk'=>array(
            'class'=>'ext.yii-antispam.CleanTalkApi',
            'apiKey'=>'*****',
        ),
    ...
),
- Add validator in your model, for example ContactForm
class ContactForm extends CFormModel
{
    public $name;
    public $email;
    public $body;
    ...
    public function rules()
    {
        return array(
            ...
            array('body', 
                    'ext.yii-antispam.CleanTalkValidator', 
                    'check'=>'message', /* Check type message or user */
                    'emailAttribute'=>'email',  
                    'nickNameAttribute'=>'name',
                    /*'on'=>'insert' if ActiveRecord using */),
            ...
        );
    }
    ...
}
- In form view add special hidden element
<?php $form=$this->beginWidget('CActiveForm', array(
    ...
    <?php echo Yii::app()->cleanTalk->checkJsHiddenField()?>
    ...
    <?php echo CHtml::submitButton('Submit'); ?>
    ...
<?php $this->endWidget(); ?>
##License GNU General Public License
##Resources