zrashwani/key-pic 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

zrashwani/key-pic

Composer 安装命令:

composer require zrashwani/key-pic

包简介

psr7 compatible composer package for key pic spam detection webservice

README 文档

README

SensioLabsInsight Scrutinizer Code Quality

This library provides a wrapper to use KeyPic web service for spam detection, by using any PSR-7 compliant request (RequestInterface objects).

How to Install

You can install this library with Composer. Drop this into your composer.json manifest file:

{
    "require": {
        "zrashwani/key-pic": "dev-master"
    }
}

Then run composer install.

How to use

To use keypic web service with any request that implements PSR-7:

require 'vendor/autoload.php';
use Zrashwani\KeyPic\KeyPic;

$keypicObj = new KeyPic($psrRequest); //initiate and configure keypic object
$keypicObj = $keypicObj->setFormID('YOUR_KEYPIC_FORM_ID') //set form ID
                       ->setDebug(true) // set debug mode
                       ->setTokenInputName("keypic_token"); //hidden input name
$token = $keypicObj->getToken();

if($psrRequest->getMethod() == "POST"){
    $data         = $psrRequest->getParsedBody();    
    $email        = $data['EMAIL_INPUT'];
    $username     = $data['NAME_INPUT'];
    $message      = $data['MESSAGE_INPUT'];
    
    //Detect if entry is Spam? from 0% to 100%
    $spam = $keypicObj->isSpam($email, $username, $message);
    if($spam === false){
       echo "Cannot determine spam percentage.";
    }elseif($spam > 60){ //if spam percentage larger than certain number
        echo "user and/or submitted data seems spammy, spam percentage = ".$spam;
    }else{
        echo "Not Spam";
    }
}

In your form, place the call to renderHtml() method to render pixel image or javascript, along with keypic hidden token field as following:

<form action="" method="post">
    <!-- Your form elements here -->
    <?php echo $keypicObj->renderHtml(); ?>
</form>

How to Contribute

  1. Fork this repository
  2. Create a new branch for each feature or improvement
  3. Send a pull request from each feature branch

It is important to separate new features or improvements into separate feature branches, and to send a pull request for each branch.

All pull requests must adhere to the PSR-2 standard.

System Requirements

  • PHP 5.4.0+

License

MIT Public License

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-11-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固