2017 © Pedro PelĂĄez
 

library akismet

Akismet Library

image

openclassrooms/akismet

Akismet Library

  • Wednesday, December 14, 2016
  • by openclassrooms-admin
  • Repository
  • 16 Watchers
  • 3 Stars
  • 23,907 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 13 % Grown

The README.md

Akismet

SensioLabsInsight Build Status Coverage Status, (*1)

This is a PHP5 library that provides Akismet Spam Protection service functionality in your application., (*2)

Installation

The easiest way to install Akismet Library is via composer., (*3)

Create the following composer.json file and run the php composer.phar install command to install it., (*4)

{
    "require": {
        "openclassrooms/akismet": "*"
    }
}

```php <?php require 'vendor/autoload.php';, (*5)

use OpenClassrooms\Akismet\Services\AkismetService;, (*6)

//do things, (*7)


## Basic Usage The `AkismetServiceImpl` class needs to set a client to communicate with Akismet Spam Protection service. This library provides a client based on GuzzleHttp\Client, though you can implement your own client. Then, you can set the client using the ```AkismetServiceImpl::setClient()``` method. ### The Models #### Comment This Library defines a "Comment" interface which must be passed as an argument into the different AkismetService methods. ```php use OpenClassrooms\Akismet\Models\Comment; $comment = new CommentImpl();

Comment Builder

This library provides a Builder to create the Comment:, (*8)

use OpenClassrooms\Akismet\Models\CommentBuilder;

$comment = $commentBuilder->create()
                          ->withUserIp(CommentStub::USER_IP)
                          ->withUserAgent(CommentStub::USER_AGENT)
                          ->withReferrer(CommentStub::REFERRER)
                          ->withPermalink(CommentStub::PERMALINK)
                          ->withAuthorName(CommentStub::AUTHOR_NAME)
                          ->withAuthorEmail(CommentStub::AUTHOR_EMAIL)
                          ->withContent(CommentStub::CONTENT)
                          ->build();

Service

Use OpenClassrooms\Akismet\Services\Impl\AkismetServiceImpl;

$akismetService = new AkismetServiceImpl();

// commentCheck method needs only one parameter, which has to be the Comment object
if ($akismetService->commentCheck($comment)) {
 // store the comment and mark it as spam (in case of a misdiagnosis).
} else {
 // store the comment normally
}

to submit misdiagnosed spam and ham, which improves the system for everybody., (*9)

$akismetService->submitSpam($comment);

And, (*10)

$akismetService->submitHam($comment);

Beyond this Library

If you plan to use Akismet Library in a Symfony2 project, check out the AkismetBundle. The bundle provides an easy configuration option for this library., (*11)

The Versions

14/12 2016

dev-master

9999999-dev

Akismet Library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arnaud Lefèvre
by OpenClassrooms

14/12 2016

v2.0.1

2.0.1.0

Akismet Library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arnaud Lefèvre
by OpenClassrooms

16/03 2016

v1.0.0

1.0.0.0

Akismet Library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arnaud Lefèvre
by OpenClassrooms