PHPackages                             gothick/php-akismet - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. gothick/php-akismet

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

gothick/php-akismet
===================

Akismet PHP Client

2.0.0(1y ago)3745[1 issues](https://github.com/gothick/php-akismet/issues)Apache-2.0PHPPHP &gt;=8.1

Since Sep 4Pushed 1y ago2 watchersCompare

[ Source](https://github.com/gothick/php-akismet)[ Packagist](https://packagist.org/packages/gothick/php-akismet)[ Docs](https://github.com/gothick/phpbb-akismet)[ RSS](/packages/gothick-php-akismet/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (2)Versions (7)Used By (0)

php-akismet
===========

[](#php-akismet)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/6a52f2560c57e6f7174ae31e940e77dd01c73b4d01632abbc5493929128e1884/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f676f746869636b2f7068702d616b69736d65742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/gothick/php-akismet/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/cf58985b812da717c9ebe6be212f3811a3d46c9148071d83d5b1428c1b38d96a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f676f746869636b2f7068702d616b69736d65742f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/gothick/php-akismet/?branch=master)[![Build Status](https://camo.githubusercontent.com/cc1b39ee08621da8c5be0ec57ea10af4c3575056650a497a54351593a0f00bca/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f676f746869636b2f7068702d616b69736d65742f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/gothick/php-akismet/build-status/master)

A simple PHP Akismet client.

- PSR-4 autoloading
- Composer-friendly
- Uses Guzzle as its http client
- Exposes all Akismet methods and return values
- Available [on Packagist](https://packagist.org/packages/gothick/php-akismet)

Simple Usage
============

[](#simple-usage)

Spam checking
-------------

[](#spam-checking)

Uses Akismet's `comment-check` API method:

```
    $client = new \Gothick\AkismetClient\Client(
        "http://example.com",   // Your website's URL (this becomes Akismet's "blog" parameter)
        "Example Forum",        // Your website or app's name (Used in the User-Agent: header when talking to Akismet)
        "1.2.3",                // Your website or app's software version (Used in the User-Agent: header when talking to Akismet)
        "YOUR KEY HERE"         // Your Akismet API key
    );

    // See https://akismet.com/development/api/#comment-check for all available parameters
    $params = [
        "user_ip" => "203.0.113.4", // IP address of person posting the comment
        "user_agent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8", // User-Agent header of the commenter
        "comment_type" => "forum-post",
        "comment_author" => "Spammy McSpamface",
        "comment_content" => "I'm an evil spammy message"
    ]

    // $result will be of type \Gothick\AkismetClient\Result\CommentCheckResult.php
    // Akismet really wants to see your $_SERVER variables. "This data is highly useful to
    // Akismet. How the submitted content interacts with the server can be very telling,
    // so please include as much of it as possible." But obviously, if you're worried,
    // you could filter anything senstive out and send in a pared-down array instead.
    $result = $client->commentCheck($params, $_SERVER);

    $is_spam = $result->isSpam(); // Boolean
```

More advanced usage
-------------------

[](#more-advanced-usage)

```
    // ...get $result from client as above...
    // If it's blatant spam that Akismet thinks you can discard without human
    // intervention (see https://blog.akismet.com/2014/04/23/theres-a-ninja-in-your-akismet/)
    $is_blatant_spam = $result->isBlatantSpam();

    // Get the X-akismet-pro-tip header, if present
    if ($result->hasProTip()) {
        $pro_tip = $result->getProTip();
    }

    // Get the X-akismet-debug-help header, if present
    if ($result->hasDebugHelp()) {
        $debug_help = $result->getDebugHelp();
    }
```

Verifying your API key
----------------------

[](#verifying-your-api-key)

```
    $client = new \Gothick\AkismetClient\Client(
        "http://example.com",   // Your website's URL (this becomes Akismet's "blog" parameter)
        "Example Forum",        // Your website or app's name (Used in the User-Agent: header when talking to Akismet)
        "1.2.3",                // Your website or app's software version (Used in the User-Agent: header when talking to Akismet)
        "YOUR KEY HERE"         // Your Akismet API key
    );

    // $result will be of type \Gothick\AkismetClient\Result\VerifyKeyResult
    $result = $client->verifyKey();
    $api_key_is_valid = $result->isValid(); // Boolean

    // Can also check pro tip and debug help as above.
```

Submitting ham and spam
-----------------------

[](#submitting-ham-and-spam)

This client also exposes Akismet's `submit-spam` and `submit-ham` methods. Use them as with commentCheck above, passing exactly the same parameters. See the Akismet API documentation for more details.

```
    $client->submitHam($params, $_SERVER);
    // OR
    $client->submitSpam($params, $_SERVER);
```

Using a custom Guzzle client
============================

[](#using-a-custom-guzzle-client)

If you have particular network transport needs, you may override the default Guzzle client that the Akismet client uses by passing a Guzzle client as the last constructor parameter:

```
$guzzle_client = new \GuzzleHttp\Client([
    'timeout' => 10.0,
    'handler' => $my_special_handler_stack
]);
$akismet_client = new \Gothick\AkismetClient\Client(
    "http://example.com",   // Your website's URL (this becomes Akismet's "blog" parameter)
    "Example Forum",        // Your website or app's name (Used in the User-Agent: header when talking to Akismet)
    "1.2.3",                // Your website or app's software version (Used in the User-Agent: header when talking to Akismet)
    "YOUR KEY HERE",        // Your Akismet API key
    $guzzle_client
);

```

Error handling
==============

[](#error-handling)

The client should either Just Work or throw `\Gothick\AkismetClient\AkismetException`, which is an entirely trivial extension of the PHP `\Exception` base class.

Tests
=====

[](#tests)

A unit test suite is provided; install the package using Composer with dev requirements, then (you'll need PHP 8.1+ and PHPUnit 10.5+):

```
    php vendor/bin/phpunit -c test/phpunit.xml.dist
```

You'll notice some tests are skipped. The majority of the tests use mock Guzzle responses, require no network connectivity, and don't touch the Akismet servers. If you wish to run the "live" tests that connect to the API server, provide your API key in an environment variable:

```
    export AKISMET_API_KEY="YOUR API KEY"
    php vendor/bin/phpunit -c test/phpunit.xml.dist
```

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 95.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2691 days

Total

2

Last Release

471d ago

Major Versions

1.0.0 → 2.0.02025-02-02

PHP version history (2 changes)1.0.0PHP &gt;=5.6

2.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/4a756695a21a81e77b48e1aaf796fc5ba16d97344085ebd4d33965887311ae94?d=identicon)[gothick](/maintainers/gothick)

---

Top Contributors

[![gothick](https://avatars.githubusercontent.com/u/225213?v=4)](https://github.com/gothick "gothick (125 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gothick-php-akismet/health.svg)

```
[![Health](https://phpackages.com/badges/gothick-php-akismet/health.svg)](https://phpackages.com/packages/gothick-php-akismet)
```

###  Alternatives

[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[dhlparcel/magento2-plugin

DHL Parcel plugin for Magento 2

11180.5k2](/packages/dhlparcel-magento2-plugin)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
