承接 cleantalk/yii2-antispam 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cleantalk/yii2-antispam

最新稳定版本:v1.1.0

Composer 安装命令:

composer require cleantalk/yii2-antispam

包简介

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

README 文档

README

Build Status

Spam Bot Protection for Yii2 Forms — reCAPTCHA Alternative.

Anti-spam extension for the Yii2 framework powered by the CleanTalk API.
Invisible protection from spam bots on contact, comment, and registration forms — no reCAPTCHA, no puzzles, no delays.

Features

  • Works invisibly in the background (no user interaction required)
  • Blocks spam bots using CleanTalk’s multi-layered checks
  • reCAPTCHA-free UX — no puzzles, images, or questions
  • Easy integration into Yii2 forms and models
  • Supports contact forms, comment forms, and registration forms

If you find this project useful, please consider starring ⭐ it on GitHub — it helps us grow and support development!

Websites that trust CleanTalk!

CleanTalk Anti-Spam Rating

Requirements

Installation

The preferred way to install this extension is through composer.

Either run

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

or add

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

to the require section of your composer.json.

##Usage

  1. Get access key on https://cleantalk.org/register?platform=yii2

  2. Open your application configuration in protected/config/web.php and modify components section:

// application components
'components'=>[
    ...
        'antispam' => [
            'class' => 'cleantalk\antispam\Component',
            'apiKey' => 'Your API KEY',
        ],
    ...
],
  1. Add validator in your model, for example ContactForm:
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'*/]
        ];
    }
}
  1. In form view add widget for hidden Javascript checks:
<?php $form = ActiveForm::begin(); ?>
    ...
    <?= \cleantalk\antispam\Widget::widget()?>
    ...
    <?= Html::submitButton('Submit')?>
    ...
<?php ActiveForm::end(); ?>

User registration validator

See cleantalk\antispam\validators\UserValidator

Example rules:

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

##License GNU General Public License

##Resources

统计信息

  • 总下载量: 18.27k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 4
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2015-06-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固