PHP Profanity Filter

Moderate user content in plain PHP with cURL — works on shared hosting, legacy apps, and anywhere you can't add heavy dependencies.

Quick start in PHP

<?php
$ch = curl_init("https://api.theprofanityapi.com/v1/check");
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_POST => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer " . getenv("PROFANITY_API_KEY"),
    "Content-Type: application/json",
  ],
  CURLOPT_POSTFIELDS => json_encode([
    "text" => $text, "context" => "comment", "mode" => "balanced",
  ]),
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
if ($data["flagged"]) { /* ... */ }

Why context-aware matters

A plain word list flags "this game is sick" or medical text full of anatomical terms. The Profanity API runs a five-layer pipeline that scores intent, so "die" in a gaming taunt and "die" in a real threat are handled differently. Pick a context and the engine adjusts strictness automatically.


Other integrations

Ready to ship moderation?

Get an API key and 300 free requests a month. No credit card required.

Get started free →