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
其他信息
- 授权协议: MIT
- 更新时间: 2021-10-22