2017 © Pedro Peláez
 

library akismet

PSR-7 library to communicate with Akismet service to determine if a submitted comment to your website should be considered spam or not.

image

romano83/akismet

PSR-7 library to communicate with Akismet service to determine if a submitted comment to your website should be considered spam or not.

  • Friday, December 22, 2017
  • by Romano83
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 50 % Grown

The README.md

Akismet PHP 7 class

Build Status Latest Stable Version License, (*1)

A PHP-7 class to communicate with Akismet service to determine if a submitted comment to your website should be considered spam or not., (*2)

Installation

Requirements

  • PHP 7.1

Steps to install

Run : composer require romano83/akismet or in your composer.json file, (*3)

"require": {
    "romano83/akismet" : "^1.0"
}

How to use it

Before to use it, you need an Akismet API key. Once you have one, in order to check if a comment is a spam:, (*4)

<?php
use Romano83\Akismet;

$website = 'https://your-website.com'; // must be a full URI including http:// or https://
$apikey = 'YOUR_API_KEY';
$akismet = new Akismet($website, $apikey);

$akismet->setCommentAuthor($author)
    ->setCommentAuthorEmail($email)
    ->setCommentContent($comment);

if ($akismet->isCommentSpam()) {
    // store the comment and mark it as a spam
} else {
    // store the comment normally
}

It's that simple!, (*5)

If Akismet filter wrongly tags messages, you can use this following methods :, (*6)

$akismet->submitSpam();

or, (*7)

$akismet->submitHam();

to submit mis-diagnosed spam and ham, which improves the system for everybody., (*8)

Others methods

This class provides you a set of methods in order to add parameters for comment check or submitted spam and ham. This methods are : * setUserIp (required) * setUserAgent (required) * setReferrer (note spelling) * setPermalink * setCommentType * setCommentAuthor * setCommentAuthorEmail * setCommentAuthorUrl * setCommentContent * setCommentDateGmt * setCommentPostModifiedGmt * setBlogLang * setBlogCharset * setUserRole * setIsTest, (*9)

All methods return self in order to have a fluent interface., (*10)

If you want more details for each method, look at the internal documentation or follow this link., (*11)

How to contribute

  • create a ticket in Github if you have found a bug.
  • create a new branch if you want to do a PR.
  • you must add testcases

The Versions

22/12 2017

dev-master

9999999-dev

PSR-7 library to communicate with Akismet service to determine if a submitted comment to your website should be considered spam or not.

  Sources   Download

MIT

The Requires

 

The Development Requires

php spam akismet php 7

07/12 2017

1.0

1.0.0.0

PSR-7 library to communicate with Akismet service to determine if a submitted comment to your website should be considered spam or not.

  Sources   Download

MIT

The Requires

 

The Development Requires