Akismet for PHP

Client
in package

Submits comments to the [Akismet](https://akismet.com) service.

Table of Contents

$apiKey  : string
The Akismet API key.
$baseUrl  : UriInterface
The base URL of the remote API endpoint.
$blog  : Blog
The front page or home URL of the instance making requests.
$isTest  : bool
Value indicating whether the client operates in test mode.
$userAgent  : string
The user agent string to use when making requests.
__construct()  : mixed
Creates a new client.
checkComment()  : CheckResult
Checks the specified comment against the service database, and returns a value indicating whether it is spam.
submitHam()  : void
Submits the specified comment that was incorrectly marked as spam but should not have been.
submitSpam()  : void
Submits the specified comment that was not marked as spam but should have been.
verifyKey()  : bool
Checks the API key against the service database, and returns a value indicating whether it is valid.

Properties

$apiKey read-only

The Akismet API key.

public string $apiKey

$baseUrl read-only

The base URL of the remote API endpoint.

public UriInterface $baseUrl

$blog read-only

The front page or home URL of the instance making requests.

public Blog $blog

$isTest read-only

Value indicating whether the client operates in test mode.

public bool $isTest

$userAgent read-only

The user agent string to use when making requests.

public string $userAgent

Methods

__construct()

Creates a new client.

public __construct(string $apiKey, Blog $blog[, bool $isTest = false ][, string $userAgent = "" ][, string $baseUrl = "https://rest.akismet.com/1.1/" ]) : mixed
Parameters
$apiKey : string

The Akismet API key.

$blog : Blog

The front page or home URL of the instance making requests.

$isTest : bool = false

Value indicating whether the client operates in test mode.

$userAgent : string = ""

The user agent string to use when making requests.

$baseUrl : string = "https://rest.akismet.com/1.1/"

The base URL of the remote API endpoint.

Return values
mixed

checkComment()

Checks the specified comment against the service database, and returns a value indicating whether it is spam.

public checkComment(Comment $comment) : CheckResult
Parameters
$comment : Comment

The comment to be submitted.

Return values
CheckResult

A value indicating whether the specified comment is spam.

submitHam()

Submits the specified comment that was incorrectly marked as spam but should not have been.

public submitHam(Comment $comment) : void
Parameters
$comment : Comment

The comment to be submitted.

Tags
throws
ClientExceptionInterface

The remote server returned an invalid response.

Return values
void

submitSpam()

Submits the specified comment that was not marked as spam but should have been.

public submitSpam(Comment $comment) : void
Parameters
$comment : Comment

The comment to be submitted.

Tags
throws
ClientExceptionInterface

The remote server returned an invalid response.

Return values
void

verifyKey()

Checks the API key against the service database, and returns a value indicating whether it is valid.

public verifyKey() : bool
Return values
bool

true if the specified API key is valid, otherwise false.

Search results