承接 zexbre/spam-protect 相关项目开发

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

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

zexbre/spam-protect

最新稳定版本:v0.3.0

Composer 安装命令:

composer require zexbre/spam-protect

包简介

A simple, driver based spam protection package.

README 文档

README

A simple, driver based spam protection package.

Check for spam messages on client requests before forwarding them to the system for further processing.

Installation

Install the latest version with

$ composer require zexbre/spam-protect

Basic Usage

Client side

<?php use ZexBre\SpamProtect\Factory\ReCaptchaVersion2Factory; ?>

<html>
    <head>
        <?php
        // ...
        $widgetData = ReCaptchaVersion2Factory::getWidgetResponse([
            'reCaptchaSiteKey' => [RECAPTCHA-SITE-KEY],
            'hl' => [LANGUAGE-CODE], // optional
        ]);
        echo $widgetData->htmlHead;
        ?>
    </head>

    <body>
        <?php
        // ...
        echo $widgetData->htmlBody;
        ?>
    </body>
<html>

Server side

<?php

use ZexBre\SpamProtect\Factory\ReCaptchaVersion2Factory;

// (1/3) preparation
$spamProtect = ReCaptchaVersion2Factory::getProtector([
    'reCaptchaSecretKey' => [RECAPTCHA-SECRET-KEY],
    'gReCaptchaResponse' => [RECAPTCHA-RESPONSE],
    'acceptLanguage' => [ACCEPT-LANGUAGE-HEADER], // optional
    'httpReferer' => [HTTP-REFERER-HEADER], // optional, see '$_SERVER["HTTP_REFERER"]'
    'httpUserAgent' => [HTTP-USER-AGENT-HEADER], // optional, see '$_SERVER["HTTP_USER_AGENT"]'
]);

// (2/3) verification
$spamProtect->verify();

// (3/3) validation
$isHuman = $spamProtect->isHuman(); // boolean
$isRobot = $spamProtect->isRobot(); // boolean
$isValidResponse = $spamProtect->isValidResponse(); // boolean
$isInvalidResponse = $spamProtect->isInvalidResponse(); // boolean
$errors = $spamProtect->getErrors(); // array

Change log

Please see CHANGELOG-0.x for more information what has changed recently.

Contributing

Please see CONTRIBUTING and CODE OF CONDUCT for details.

Security

If you discover any security related issues, please email to niks986@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-10-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固