KireiFilter

PHP integration guide

Add spam detection to any PHP application. No library required — plain HTTP with file_get_contents, Guzzle, or the Symfony HTTP client.

Authentication: All requests need a Bearer token in the Authorization header. Generate one in Settings → API Tokens.

Native PHP — file_get_contents

No dependencies. Works on any PHP 7.4+ installation.

spam_check.php
function checkSpam(string $type, string $content, string $ip = ''): array {
$response = file_get_contents(
'https://kireifilter.net/api/v1/spam-check',
false,
stream_context_create(['http' => [
'method' => 'POST',
'header' => "Authorization: Bearer " . YOUR_TOKEN . "\r\nContent-Type: application/json",
'content' => json_encode([
'type' => $type,
'content' => $content,
'metadata' => ['ip' => $ip],
]),
]])
);
return json_decode($response, true);
}
// Usage
$result = checkSpam('comment', $_POST['message'], $_SERVER['REMOTE_ADDR']);
if ($result['isSpam']) { http_response_code(422); exit; }

Guzzle

For projects already using Guzzle or the Symfony HTTP client.

spam_check_guzzle.php
$client = new GuzzleHttp\Client();
$res = $client->post('https://kireifilter.net/api/v1/spam-check', [
'headers' => ['Authorization' => 'Bearer ' . YOUR_TOKEN],
'json' => ['type' => 'comment', 'content' => $content, 'metadata' => ['ip' => $ip]],
]);
$result = json_decode($res->getBody(), true);

Response fields

FieldTypeDescription
isSpambooleantrue if score ≥ 0.5
scorefloat0.0 (clean) to 1.0 (spam). Threshold is 0.5.
reasonsstring[]Detection signals that contributed to the score

Ready to integrate?

Free plan — 100 checks/month.

Other languages: Python Node.js WordPress