Search by

omnishield / akismet

GlitchArt

Omnishield Akismet: is this content spam - comment-check (ham, spam, or flagrant spam to discard), submit-spam and submit-ham to teach it, verify-key; a key or transport error raised, never taken for ham.

1.x-dev 2026-10-09 15:30 UTC

This package is not auto-updated.

Last update: 2026-10-10 14:18:47 UTC


README

Akismet for glitchr/omnishield: is this content spam. comment-check answers ham, spam, or spam flagrant enough to discard; submit-spam and submit-ham teach it; verify-key checks a key once, when it is typed in.

use Omnishield\Akismet\AkismetGatewayFactory;
use Omnishield\Model\Submission;

$akismet = (new AkismetGatewayFactory($httpClient))->create(['api_key' => getenv('AKISMET_API_KEY'), 'site' => 'https://example.org']);

$classification = $akismet->classify(new Submission(
    content: $text, author: $name, email: $email, url: $website,
    ip: $ip, userAgent: $userAgent, referrer: $referrer, permalink: $pageUrl,
    language: 'fr', type: Submission::COMMENT, date: new DateTimeImmutable(),
));
$classification->label;      // Label::HAM, Label::SPAM, Label::FLAGRANT (X-akismet-pro-tip: discard)

$akismet->report($submission, spam: true);   // a spam it let through
omnishield:
    gateways:
        comments:
            factory: akismet
            options: { api_key: '%env(AKISMET_API_KEY)%', site: 'https://example.org' }

An error is never taken for ham: a key Akismet refuses is an InvalidKeyException, a request it could not read a ProviderException, no answer an UnreachableException - whether the content goes through then is the application's call. The text, the name, the e-mail and the address of the visitor go to Akismet (Automattic): say so in the privacy policy.

Documentation: the fields sent, the answers, the options, what was verified - nothing against Akismet itself: no key.

License: MIT since 2026-10-09; earlier versions remain published under LGPL-3.0-or-later.

Formerly omniguard/akismet, renamed on 2026-10-10 with its family (glitchr/omnishield).