Aller au contenu

omnishield/akismet Référence de l’API

Étage
Fournisseur · Omnishield
Version
1.x
Suite de conformité
branchée, CI non lue
Vérifié en réel
Vérifié en réel
Licence
MIT
composer require omnishield/akismet:1.x-dev

Lue dans les fichiers PHP du paquet au commit 643b591aaf51 : ses espaces de noms, classes, interfaces et énumérations, leurs constantes, propriétés et méthodes publiques avec leur PHPDoc, et les options que prennent ses fabriques. Rien n’en est exécuté.

Omnishield\Akismet

  • AkismetGateway class

    Akismet's REST API (https://akismet.com/developers/detailed-docs/): the key as the api_key parameter on https://rest.akismet.com/1.1/ - the <key>.rest.akismet.com form is the older one.

    8 methods · 1 constant

  • AkismetGatewayFactory class

    Akismet: is this content spam.

    5 options · 1 method

Omnishield\Akismet

AkismetGateway class

final class AkismetGateway implements ClassifierInterface AkismetGateway.php:31

Akismet's REST API (https://akismet.com/developers/detailed-docs/): the key as the api_key parameter on https://rest.akismet.com/1.1/ - the <key>.rest.akismet.com form is the older one.

  • comment-check: "false" is ham, "true" spam - flagrant when the X-akismet-pro-tip header says "discard" -, "invalid" an error;
  • submit-spam, submit-ham: "Thanks for making the web a better place.";
  • verify-key: "valid" or "invalid".

An error is never taken for ham: a key refused is an InvalidKeyException, a request Akismet could not read a ProviderException, no answer an UnreachableException. Whether to let the content through then is the application's call.

const BASE_URI = 'https://rest.akismet.com/1.1/'

AkismetGateway::__construct()

public function __construct(readonly HttpClientInterface $http, readonly string $apiKey, readonly ?string $site = null, readonly ?string $language = null, readonly bool $test = false, readonly string $baseUri = self::BASE_URI)

AkismetGateway::getName()

public function getName(): string

AkismetGateway::getTitle()

public function getTitle(): string

AkismetGateway::capabilities()

public function capabilities(): Capabilities

AkismetGateway::classify()

public function classify(Submission $submission): Classification

AkismetGateway::report()

public function report(Submission $submission, bool $spam): void

AkismetGateway::verifyKey()

public function verifyKey(?string $site = null): bool

Whether Akismet takes the key for the site - once, when the key is typed in, not before every call.

AkismetGateway::fields()

public function fields(Submission $submission): array
Returns

what Akismet is told of a submission

AkismetGatewayFactory class

final class AkismetGatewayFactory extends GatewayFactory AkismetGatewayFactory.php:21

Akismet: is this content spam.

options: api_key: '%env(AKISMET_API_KEY)%' # required site: https://example.org # the site's home page ("blog"), when a submission does not carry one language: ~ # the site's language ("blog_lang"), when a submission does not carry one: fr, fr_FR test: false # true: is_test - Akismet answers, and learns nothing base_uri: https://rest.akismet.com/1.1/

Options

OptionDefault
sitenull
languagenull
testfalse
base_uriAkismetGateway::BASE_URI
api_keyrequired

AkismetGatewayFactory::__construct()

public function __construct(readonly ?HttpClientInterface $http = null)