2017 © Pedro Peláez
 

library key-pic

psr7 compatible composer package for key pic spam detection webservice

image

zrashwani/key-pic

psr7 compatible composer package for key pic spam detection webservice

  • Friday, January 8, 2016
  • by zrashwani
  • Repository
  • 1 Watchers
  • 1 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

# Keypic

SensioLabsInsight Scrutinizer Code Quality, (*1)

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

How to Install

You can install this library with Composer. Drop this into your composer.json manifest file:, (*3)

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

Then run composer install., (*4)

How to use

To use keypic web service with any request that implements PSR-7:, (*5)

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:, (*6)

<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., (*7)

All pull requests must adhere to the PSR-2 standard., (*8)

System Requirements

  • PHP 5.4.0+

License

MIT Public License, (*9)

The Versions

08/01 2016

dev-master

9999999-dev

psr7 compatible composer package for key pic spam detection webservice

  Sources   Download

MIT

The Requires

 

The Development Requires

captcha spam detection

13/11 2015

1.0.2

1.0.2.0

psr7 compatible composer package for key pic spam detection webservice

  Sources   Download

MIT

The Requires

 

The Development Requires

captcha spam detection

13/11 2015

1.0.1

1.0.1.0

psr7 compatible composer package for key pic spam detection webservice

  Sources   Download

MIT

The Requires

 

The Development Requires

captcha spam detection

13/11 2015

1.0.0

1.0.0.0

psr7 compatible composer package for key pic spam detection webservice

  Sources   Download

MIT

The Requires

 

The Development Requires

captcha spam detection