PHPackages                             denismitr/spam-detector - 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. denismitr/spam-detector

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

denismitr/spam-detector
=======================

PHP Spam Detector

v0.4(7y ago)117MITPHPPHP ^7.0

Since Aug 22Pushed 7y ago1 watchersCompare

[ Source](https://github.com/denismitr/spam-detector)[ Packagist](https://packagist.org/packages/denismitr/spam-detector)[ RSS](/packages/denismitr-spam-detector/feed)WikiDiscussions master Synced 2w ago

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

Spam Detector
=============

[](#spam-detector)

### Author

[](#author)

Denis Mitrofanov

### Installation

[](#installation)

```
composer require denismitr/spam-detector

```

### Usage

[](#usage)

You can pass as many inspections as you want to the `Denismitr\Spam\Spam` class constructor. Every inspection must implement `Denismitr\Spam\Contracts\Inspection` interface. Right now, out of the box, you get **6** of them:

- Denismitr\\Spam\\Inspections\\AsciiOnly
- Denismitr\\Spam\\Inspections\\YahooCustomerSupport
- Denismitr\\Spam\\Inspections\\RussianForbiddenWords
- Denismitr\\Spam\\Inspections\\RussianBadWords
- Denismitr\\Spam\\Inspections\\KeyHeldDown
- Denismitr\\Spam\\Inspections\\EnglishForbiddenWords

An example of usage:

```
$text = "Some text to check";

$spam = new Spam([
    YahooCustomerSupport::class,
    RussianForbiddenWords::class,
    RussianBadWords::class,
    KeyHeldDown::class
]);

try {
    $spam->detect($text);
} catch(SpamDetected $e) {
    // Do stuff
}

```

or to see if any of the given fields contain spam use ```detectAny`` method

```
try {
    $spam->detectAny([
        'title' => 'Some title...',
        'body' => 'Some body...'
    ]);
} catch(SpamDetected $e) {
    // Do stuff
}

```

This method will **throw** if any of the given fields contain spam.

And, of course, if you need, another method `detectAll` will throw if all fields contain spam:

```
try {
    $spam->detectAll([
        'title' => 'Some title...',
        'body' => 'Some body...'
    ]);
} catch(SpamDetected $e) {
    // Do stuff
}

```

---

Another usecase is when you want to check against only one inspection. For this case there is a static method **inspect** that accepts a string for a haystack and the Inspection **instance** like so:

```
$text = 'Some text to check';

try {
    Spam::inspect($text, new KeyHeldDown);
} catch(SpamDetected $e) {
    // Do stuff
}

```

---

You can easily add your own inspections. They must implement `Inspection` interface. That looks like so:

```
interface Inspection
{
    /**
     * @param string $text
     * @return void
     */
    public function detect(string $text);
}

```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

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

Total

4

Last Release

2914d ago

PHP version history (2 changes)v0.1PHP ^7.0,&lt;7.2

v0.4PHP ^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/6d68ae5d5ca94f49a69f961a7825865d92247b09e276a25fcc6ad485d4c8c964?d=identicon)[denismitr](/maintainers/denismitr)

---

Top Contributors

[![denismitr](https://avatars.githubusercontent.com/u/16356446?v=4)](https://github.com/denismitr "denismitr (11 commits)")

### Embed Badge

![Health badge](/badges/denismitr-spam-detector/health.svg)

```
[![Health](https://phpackages.com/badges/denismitr-spam-detector/health.svg)](https://phpackages.com/packages/denismitr-spam-detector)
```

###  Alternatives

[pragmatic-modules/magento2-module-system-configuration-toolkit

System Configuration Toolkit is a Magento 2 module that shows sort order of system configuration's tabs, sections, groups, and fields. It also helps you to see full field paths, so no more looking for those.

3212.0k](/packages/pragmatic-modules-magento2-module-system-configuration-toolkit)

PHPackages © 2026

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