PHPackages                             ralkage/flarum-ext-civility-filter - 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. ralkage/flarum-ext-civility-filter

ActiveFlarum-extension[Utility &amp; Helpers](/categories/utility)

ralkage/flarum-ext-civility-filter
==================================

AI-powered civility filter that analyzes posts for incivility using Anthropic Claude, OpenAI GPT, or OpenRouter

1.0.1(3mo ago)05MITPHP

Since Mar 22Pushed 3mo agoCompare

[ Source](https://github.com/Ralkage/flarum-ext-civility-filter)[ Packagist](https://packagist.org/packages/ralkage/flarum-ext-civility-filter)[ Docs](https://ralkage.com)[ RSS](/packages/ralkage-flarum-ext-civility-filter/feed)WikiDiscussions 1.x Synced 3w ago

READMEChangelog (3)Dependencies (1)Versions (5)Used By (0)

Civility Filter
===============

[](#civility-filter)

[![License: MIT](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

AI-powered content moderation extension for [Flarum](https://flarum.org) that automatically analyzes posts for civility using **Anthropic Claude**, **OpenAI GPT**, or **OpenRouter**.

Features
--------

[](#features)

### AI Analysis

[](#ai-analysis)

- Analyzes posts in real-time before they're published
- Supports **Anthropic Claude** (Haiku, Sonnet, Opus), **OpenAI GPT** (5.4 Nano, 5.4 mini, 5.4 generic), and **OpenRouter** (200+ models)
- Customizable AI prompt for tailored moderation rules
- Fail-open design — posts go through if the API is unavailable

### 4-Tier Action System

[](#4-tier-action-system)

ActionDefault ThresholdBehavior**Allowed**0–59Post published normally**Warned**60–79Post published, logged, user notified**Moderated**80–94Post held in moderation queue for review**Blocked**95–100Post rejected, user sees error messageAll thresholds are configurable in 5-point increments.

### Content Filtering

[](#content-filtering)

- **Word Blocklist** — Instant block on matching keywords without calling the AI (saves API costs)
- **Tag-Based Monitoring** — Only analyze posts in specific tags, or monitor all
- **Quoted Content Exclusion** — Strips quoted text before analysis so users aren't penalized for quoting others

### Moderation Tools

[](#moderation-tools)

- **Civility Log** — Paginated, filterable log of all analysis results
- **Statistics Dashboard** — Action breakdown, top categories, top offenders, and daily trend charts
- **Test Analyzer** — Test messages against the AI before deploying settings
- **CSV Export** — Download the full civility log for offline review
- **Quick Actions** — Approve, delete, or suspend directly from the log table

### Automated Enforcement

[](#automated-enforcement)

- **Auto-Suspend** — Automatically suspend users after X violations within a configurable time window
- **API Rate Limiting** — Cap AI API calls per hour to control costs during traffic spikes

### Notifications

[](#notifications)

- **In-App Alerts** — Users are notified when their posts are warned or moderated
- **Discord/Webhook Alerts** — Send rich embeds to Discord or JSON payloads to any webhook URL when posts are flagged

### Forum Integration

[](#forum-integration)

- **Post Badges** — Visual notices on warned/moderated posts (visible to author and staff only)
- **User Profile History** — Per-user civility stats and recent violations (admin only)
- **Bypass Permission** — Exempt trusted users/groups from civility checks

Installation
------------

[](#installation)

```
composer require ralkage/flarum-ext-civility-filter
php flarum migrate
php flarum cache:clear
```

Enable the extension in the admin panel under **Extensions &gt; Civility Filter**.

Configuration
-------------

[](#configuration)

Navigate to the extension settings page in the admin panel. The settings are organized into sections:

### General

[](#general)

- **Enable Civility Filter** — Master on/off switch

### AI Provider

[](#ai-provider)

- **AI Provider** — Choose between Anthropic (Claude), OpenAI (GPT), or OpenRouter
- **Anthropic API Key** — Your Anthropic API key
- **OpenAI API Key** — Your OpenAI API key
- **OpenRouter API Key** — Your OpenRouter API key (access 200+ models from one API)
- **AI Model** — Select the model for your chosen provider

### Thresholds

[](#thresholds)

- **Warn Threshold** — Score to trigger a warning (default: 60)
- **Hold/Moderate Threshold** — Score to hold for moderation (default: 80)
- **Block Threshold** — Score to block the post (default: 95)

### Filtering

[](#filtering)

- **Monitored Tags** — Multi-select tag picker to limit which tags are monitored
- **Word Blocklist** — One word/phrase per line, instantly blocks without AI

### Custom Prompt

[](#custom-prompt)

- **Custom AI Prompt** — Override the default analysis prompt with your own instructions

### Auto-Suspend

[](#auto-suspend)

- **Threshold** — Number of violations before auto-suspend (0 = disabled)
- **Duration** — Suspension length in days
- **Window** — Count violations within this many days

### Webhooks

[](#webhooks)

- **Webhook URL** — Discord webhook or generic endpoint
- **Minimum Action** — Only alert for this severity or higher

### Logging &amp; Limits

[](#logging--limits)

- **Log All Checks** — Include passing posts in the log
- **Rate Limit** — Maximum API calls per hour (0 = unlimited)

Permissions
-----------

[](#permissions)

PermissionDescriptionBypass Civility FilterUsers with this permission skip all civility analysisConfigure under the **Permissions** section of the extension settings page.

API Endpoints
-------------

[](#api-endpoints)

All endpoints require admin authentication unless noted.

MethodEndpointDescription`GET``/api/civility-logs`List logs (paginated, filterable)`DELETE``/api/civility-logs`Clear all logs`GET``/api/civility-logs/export`Download CSV export`GET``/api/civility-logs/stats`Statistics and trends`POST``/api/civility-logs/test`Test analyzer`POST``/api/civility-logs/moderate`Quick actions (approve/delete/suspend)`GET``/api/civility-logs/user?userId=X`Per-user civility historyScoring Guide
-------------

[](#scoring-guide)

The AI evaluates posts on a 0–100 scale:

Score RangeMeaning0–20Civil, constructive, or neutral21–40Mildly rude or snarky but not harmful41–60Hostile tone, dismissive, or antagonistic61–80Personal attacks, inflammatory language, bad-faith arguing81–95Hate speech, severe harassment, threats96–100Extreme abuse or dangerous contentPolitical disagreement alone is **not** considered uncivil. The AI focuses on *how* something is said, not *what* position is taken.

Categories
----------

[](#categories)

The AI categorizes issues found in posts:

`personal_attack` · `inflammatory` · `hate_speech` · `bad_faith` · `trolling` · `harassment` · `threat` · `profanity` · `discrimination`

Requirements
------------

[](#requirements)

- Flarum `^1.8`
- PHP 8.0+
- An API key from [Anthropic](https://console.anthropic.com/), [OpenAI](https://platform.openai.com/), or [OpenRouter](https://openrouter.ai/)

Links
-----

[](#links)

- [Ralkage](https://ralkage.com)
- [Github](https://github.com/Ralkage/flarum-ext-civility-filter)
- [Packagist](https://packagist.org/packages/ralkage/flarum-ext-civility-filter)

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance82

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

5

Last Release

97d ago

Major Versions

1.0.0 → 2.x-dev2026-03-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/4415106be37759e15d2f1304df343a37e478dad0f832b6f35860631ffc9b6afb?d=identicon)[Ralkage](/maintainers/Ralkage)

---

Top Contributors

[![Ralkage](https://avatars.githubusercontent.com/u/2059356?v=4)](https://github.com/Ralkage "Ralkage (9 commits)")

---

Tags

aiopenaiclaudegptmoderationOpenRoutercontent-filtercivility

### Embed Badge

![Health badge](/badges/ralkage-flarum-ext-civility-filter/health.svg)

```
[![Health](https://phpackages.com/badges/ralkage-flarum-ext-civility-filter/health.svg)](https://phpackages.com/packages/ralkage-flarum-ext-civility-filter)
```

###  Alternatives

[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

318117.1k1](/packages/cognesy-instructor-php)[symfony/ai-platform

PHP library for interacting with AI platform provider.

521.2M216](/packages/symfony-ai-platform)[genaker/magento-mcp-ai

Magento MCP AI Assistant - A powerful AI assistant for Magento 2 that helps with store data queries and management

891.5k](/packages/genaker-magento-mcp-ai)

PHPackages © 2026

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