PHPackages                             pecee/spam-validator - 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. [Framework](/categories/framework)
4. /
5. pecee/spam-validator

ActiveLibrary[Framework](/categories/framework)

pecee/spam-validator
====================

Extremely simple and lightweight PHP spam validator class to add an small additional layer of security.

1.0.1(9y ago)168MITPHPPHP &gt;=5.4.0

Since Sep 27Pushed 9y ago1 watchersCompare

[ Source](https://github.com/skipperbent/pecee-spam-validator)[ Packagist](https://packagist.org/packages/pecee/spam-validator)[ Docs](http://www.pecee.dk)[ RSS](/packages/pecee-spam-validator/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

Pecee Spam Validator class
==========================

[](#pecee-spam-validator-class)

Small lightweight class for providing an extremely simple layer of spam-security using moinmo.in's list of blacklisted spam words.

**Note:** this class will not prevent spam 100% and should only be used to add some additional security when validating the contents of your input-fields on your webste.

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

[](#installation)

Install this module by running the following composer command:

`composer require pecee/spam-validator`

Usage
-----

[](#usage)

```
$comment = $_POST['comment'];
$service = new \Pecee\Service\SpamChecker();

if($service->isSpam($comment)) {
    // Comment contains spam
} else {
    // Continue...
}
```

If no path to a spam-list is defined, the class will try to fetch the latest version from .

Please store the list locally to avoid calling moinmo.in on each request.

Methods
-------

[](#methods)

#### setPathToSpamList($path)

[](#setpathtospamlistpath)

Set path to local spam-list.

**Example:**

```
$service = new \Pecee\Service\SpamChecker();
$this->service->setPathToSpamList('/path/to/spamlist.txt');
```

#### setList($list)

[](#setlistlist)

Set the contents of the spam-list yourself.

#### setText($text)

[](#settexttext)

Text you want to validate. We would recomment using the property on the `isSpam` method instead.

#### getText()

[](#gettext)

Returns validated text.

#### downloadList()

[](#downloadlist)

Refetch the list from the external source.

Credits
-------

[](#credits)

moinmo's awesome job at creating a dictionary of spam-words.

The MIT License (MIT)
---------------------

[](#the-mit-license-mit)

Copyright (c) 2016 Simon Sessingø / pecee framework

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

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

Total

2

Last Release

3543d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

frameworkvalidatorvalidationspamfastlightweightspeedpecee

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pecee-spam-validator/health.svg)

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

###  Alternatives

[cakephp/cakephp

The CakePHP framework

8.8k19.1M1.7k](/packages/cakephp-cakephp)[davidepastore/slim-validation

A slim middleware for validation based on Respect/Validation

170227.3k3](/packages/davidepastore-slim-validation)[runn/validation

Runn Me! Validation and Sanitization Library

1027.6k2](/packages/runn-validation)[krzysztofrewak/laravel-oop-validator

Laravel Validator object-oriented wrapper

805.9k](/packages/krzysztofrewak-laravel-oop-validator)[developermarius/simple-router

Simple, fast PHP router that is easy to get integrated and in almost any project. Heavily inspired by the Laravel router.

112.5k](/packages/developermarius-simple-router)

PHPackages © 2026

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