2017 © Pedro Peláez
 

yii2-extension yii2-antispam

Anti-spam yii2 extension by CleanTalk with protection against spam bots and manual spam

image

cleantalk/yii2-antispam

Anti-spam yii2 extension by CleanTalk with protection against spam bots and manual spam

  • Wednesday, April 11, 2018
  • by CleanTalk
  • Repository
  • 3 Watchers
  • 2 Stars
  • 1,180 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 3 Versions
  • 2 % Grown

The README.md

Anti-spam extension by CleanTalk for Yii2 framework.

No Captcha, no questions, no counting animals, no puzzles, no math., (*1)

Build Status, (*2)

Requirements

  • Yii 2.0 or above
  • CleanTalk account https://cleantalk.org/register?product=anti-spam

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

php composer.phar require --prefer-dist cleantalk/yii2-antispam

or add, (*5)

"cleantalk/yii2-antispam": "~1.0.0"

to the require section of your composer.json., (*6)

Usage

1) Get access key on https://cleantalk.org/register?platform=yii2, (*7)

2) Open your application configuration in protected/config/web.php and modify components section:, (*8)

// application components
'components'=>[
    ...
        'antispam' => [
            'class' => 'cleantalk\antispam\Component',
            'apiKey' => 'Your API KEY',
        ],
    ...
],

3) Add validator in your model, for example ContactForm:, (*9)

namespace app\models;

use cleantalk\antispam\validators\MessageValidator;
use Yii;
use yii\base\Model;

/**
 * ContactForm is the model behind the contact form.
 */
class ContactForm extends Model
{
    public $name;
    public $email;
    public $body;
    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            // name, email, subject and body are required
            [['name', 'email', 'subject', 'body'], 'required'],
            // email has to be a valid email address
            ['email', 'email'],
            ['body', MessageValidator::className(), 'emailAttribute'=>'email', /*'nickNameAttribute'=>'name'*/]
        ];
    }
}

4) In form view add widget for hidden Javascript checks:, (*10)


    ...
    <?= \cleantalk\antispam\Widget::widget()?>
    ...
    <?= Html::submitButton('Submit')?>
    ...


User registration validator

See cleantalk\antispam\validators\UserValidator, (*11)

Example rules:, (*12)

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['name', 'email'], 'required'],
            ['email', 'email'],
            ['email', UserValidator::className(), 'nickNameAttribute'=>'name']
        ];
    }

License

GNU General Public License, (*13)

Resources

  • https://cleantalk.org/
  • https://github.com/CleanTalk/yii2-antispam

The Versions

11/04 2018

dev-master

9999999-dev

Anti-spam yii2 extension by CleanTalk with protection against spam bots and manual spam

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

by Avatar psrustik

yii2 antispam cleantalk

01/07 2015

dev-dev

dev-dev

Anti-spam yii2 extension by CleanTalk with protection against spam bots and manual spam

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

by Avatar psrustik

yii2 antispam cleantalk

30/06 2015

v1.0.0

1.0.0.0

Anti-spam yii2 extension by CleanTalk with protection against spam bots and manual spam

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

by Avatar psrustik

yii2 antispam cleantalk