PHPackages                             illuma-law/laravel-content-sentinel - 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. illuma-law/laravel-content-sentinel

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

illuma-law/laravel-content-sentinel
===================================

A configurable content safeguard and moderation pipeline for Laravel.

v0.1.4(1mo ago)062[1 PRs](https://github.com/illuma-law/laravel-content-sentinel/pulls)MITPHPPHP ^8.3CI passing

Since Apr 20Pushed 1mo agoCompare

[ Source](https://github.com/illuma-law/laravel-content-sentinel)[ Packagist](https://packagist.org/packages/illuma-law/laravel-content-sentinel)[ Docs](https://github.com/illuma-law/laravel-content-sentinel)[ GitHub Sponsors](https://github.com/illuma-law)[ RSS](/packages/illuma-law-laravel-content-sentinel/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (15)Versions (7)Used By (0)

Laravel Content Sentinel
========================

[](#laravel-content-sentinel)

[![Tests](https://github.com/illuma-law/laravel-content-sentinel/actions/workflows/run-tests.yml/badge.svg)](https://github.com/illuma-law/laravel-content-sentinel/actions)[![Packagist License](https://camo.githubusercontent.com/e60623f508586f049d48cfb8396ee411b0c9bc3be174381a1893c37462a3c1e5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e63652d4d49542d626c7565)](http://choosealicense.com/licenses/mit/)[![Latest Stable Version](https://camo.githubusercontent.com/f4601c42a28a62d79afe254ea3a0e89e8c700e7ebd3d33e27cae79b8d765d0f6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696c6c756d612d6c61772f6c61726176656c2d636f6e74656e742d73656e74696e656c3f6c6162656c3d56657273696f6e)](https://packagist.org/packages/illuma-law/laravel-content-sentinel)

A configurable content safeguard and moderation pipeline for Laravel applications.

Content Sentinel acts as an automated editor for user-generated content or AI-generated text. It uses a Pipeline architecture to run content through a sequence of customizable "gates" before it is processed or published. These gates can either block the content entirely (throwing a hard error) or attach warnings (flagging the content for manual review).

Features
--------

[](#features)

- **Pipeline Architecture:** Run your content through multiple independent checks sequentially.
- **Severity Levels:** Differentiates between hard blocks (e.g., prohibited phrases) and warnings (e.g., sensitive topics).
- **Built-in Gates:** Includes common checks for prohibited phrases, brand voice adherence, and duplicate content.
- **Extensible:** Easily create custom gates tailored to your business logic.

Built-in Gates
--------------

[](#built-in-gates)

GateKeySeverityDescription`ProhibitedPhrasesGate``prohibited_phrases`**block**Blocks content containing any configured prohibited phrase.`BrandVoiceGate``brand_voice`warningWarns when content contains brand-forbidden words.`DuplicateContentGate``duplicate_content`warningWarns when content similarity to recent content exceeds the threshold.`SensitiveTopicGate``sensitive_topic`warningWarns when content touches any configured sensitive topic.`HallucinationGate``hallucination`warningWarns when claims in the metadata cannot be verified.Installation
------------

[](#installation)

You can install the package via composer:

```
composer require illuma-law/laravel-content-sentinel
```

Publish the config file to customize which gates run and how they behave:

```
php artisan vendor:publish --tag="content-sentinel-config"
```

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

[](#configuration)

The published `config/content-sentinel.php` file allows you to define your pipeline and the settings for each gate:

```
return [
    // Register the gates you want to run, in order
    'gates' => [
        \IllumaLaw\ContentSentinel\Gates\ProhibitedPhrasesGate::class,
        \IllumaLaw\ContentSentinel\Gates\BrandVoiceGate::class,
        \IllumaLaw\ContentSentinel\Gates\SensitiveTopicGate::class,
    ],

    // Specific configuration for the ProhibitedPhrasesGate
    'prohibited_phrases' => [
        'swear_words',
        'competitor_name',
    ],

    // Configuration for the BrandVoiceGate
    'brand_voice_violations' => [
        'cheap',
        'guaranteed',
    ],
];
```

Usage &amp; Integration
-----------------------

[](#usage--integration)

The package works by creating a `SentinelPayload` object, running it through the `ContentSentinel` pipeline, and inspecting the resulting `SafeguardResult`.

### Using the Facade

[](#using-the-facade)

You can use the Facade to quickly evaluate a payload:

```
use IllumaLaw\ContentSentinel\Facades\ContentSentinel;
use IllumaLaw\ContentSentinel\DTOs\SentinelPayload;

$payload = new SentinelPayload(
    content: 'Our new product is cheap and guaranteed to work!',
    title: 'Product Launch',
    caption: 'Buy now!',
    metadata: ['author_id' => 123]
);

$result = ContentSentinel::check($payload);

if ($result->hasBlocks()) {
    // A block gate failed. Prevent the action.
    abort(422, 'Content violates policies: ' . json_encode($result->blocks));
}

if ($result->hasWarnings()) {
    // A warning gate failed. Allow it, but flag it for review.
    logger()->warning('Content flagged for review', $result->warnings);
}

// Proceed to save/publish...
```

### Dependency Injection

[](#dependency-injection)

Alternatively, you can resolve the `ContentSentinel` service from the container:

```
use IllumaLaw\ContentSentinel\ContentSentinel;
use IllumaLaw\ContentSentinel\DTOs\SentinelPayload;

class ContentController extends Controller
{
    public function store(Request $request, ContentSentinel $sentinel)
    {
        $payload = new SentinelPayload(content: $request->input('body'));
        $result = $sentinel->check($payload);

        if ($result->hasBlocks()) {
            return back()->withErrors(['body' => 'Contains prohibited content.']);
        }

        // ...
    }
}
```

### Creating Custom Gates

[](#creating-custom-gates)

To create your own gate, implement the `SentinelGate` interface. The gate receives the payload and the configuration array.

Use the `$payload->addResult()` method to append your check's status.

```
namespace App\Gates;

use Closure;
use IllumaLaw\ContentSentinel\Contracts\SentinelGate;
use IllumaLaw\ContentSentinel\DTOs\GateResult;
use IllumaLaw\ContentSentinel\DTOs\SentinelPayload;
use IllumaLaw\ContentSentinel\Enums\Severity;

class ProfanityGate implements SentinelGate
{
    public function __construct(private readonly array $config = []) {}

    public function handle(SentinelPayload $payload, Closure $next): SentinelPayload
    {
        if (str_contains(strtolower($payload->content), 'badword')) {
            $payload->addResult(new GateResult(
                gateKey: 'profanity_check',
                passed: false,
                severity: Severity::BLOCK, // or Severity::WARNING
                message: 'Content contains profanity.',
                details: ['word' => 'badword']
            ));
        } else {
             $payload->addResult(new GateResult(
                gateKey: 'profanity_check',
                passed: true,
                severity: Severity::INFO,
                message: 'No profanity detected.'
            ));
        }

        return $next($payload);
    }
}
```

Register your custom gate in the `config/content-sentinel.php` file:

```
    'gates' => [
        \App\Gates\ProfanityGate::class,
        // ...
    ],
```

Testing
-------

[](#testing)

Run the test suite:

```
composer test
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance91

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~2 days

Total

5

Last Release

44d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2affac64f2726a640084b203503518ca01f582536d60a0a299b614486ed95aaa?d=identicon)[miguelenes](/maintainers/miguelenes)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")[![miguelenes](https://avatars.githubusercontent.com/u/1568086?v=4)](https://github.com/miguelenes "miguelenes (2 commits)")

---

Tags

laravelilluma-lawlaravel-content-sentinel

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/illuma-law-laravel-content-sentinel/health.svg)

```
[![Health](https://phpackages.com/badges/illuma-law-laravel-content-sentinel/health.svg)](https://phpackages.com/packages/illuma-law-laravel-content-sentinel)
```

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k51.0M7.4k](/packages/larastan-larastan)[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[spatie/laravel-health

Monitor the health of a Laravel application

88011.3M149](/packages/spatie-laravel-health)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

24740.3k](/packages/harris21-laravel-fuse)[laracraft-tech/laravel-useful-additions

A collection of useful Laravel additions!

58122.8k](/packages/laracraft-tech-laravel-useful-additions)

PHPackages © 2026

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