Download the PHP package tearoom1/uniform-spam-words without Composer

On this page you can find all versions of the php package tearoom1/uniform-spam-words. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package uniform-spam-words

Spam Words Guard for Kirby Uniform

This plugin implements a simple spam words guard for Martin Zurowietz' kirby-uniform plugin for Kirby.

Getting started

Use one of the following methods to install & use tearoom1/uniform-spam-words:

Git submodule

If you know your way around Git, you can download this plugin as a submodule:

Composer

Clone or download

  1. Clone or download this repository from github: https://github.com/tearoom1/uniform-spam-words.git
  2. Unzip / Move the folder to site/plugins.

Usage

Controller

To use the plugin, you have to enable the guard by calling spamWordsGuard() on the $form object.

For more information, check out the kirby-uniform docs on its magic methods:

How it works

  1. Checks message length constraints
  2. Checks word count constraints
  3. Validates regex pattern (if configured)
  4. Runs custom validator (if configured)
  5. If addresses found (>= minAddresses), calculates spam score from keywords
  6. Rejects if thresholds exceeded

Configuration

The plugin comes with a few lists of words and phrases that are used to build a spam score. Thus the plugin should work out of the box.

You may change certain options in your global config.php

Configuration Options

Option Type Default Description
Validation Options
minLength int|null null Minimum character length required for the message. Set to null to disable.
maxLength int|null null Maximum character length allowed for the message. Set to null to disable.
minWords int|null null Minimum word count required for the message. Set to null to disable.
maxWords int|null null Maximum word count allowed for the message. Set to null to disable.
regexMatch string|null null Optional regex pattern that the message must match (e.g., /^[a-zA-Z0-9\s]+$/). Set to null to disable.
customValidator callable|null null Custom validation callback that receives the message and returns true (valid) or false (invalid). Set to null to disable.
Spam Detection Options
minAddresses int 1 Minimum number of addresses required to trigger spam word checking. Set to 0 to always check.
addressThreshold int 2 Number of addresses (links/emails) allowed before triggering spam check.
addressesWeight int 1 Weight multiplier for each address (link/email) found. Each address contributes addressesWeight points to the total spam score.
spamThreshold int 8 Spam score threshold for rejection. Higher values are more lenient.
useWordLists bool true Use built-in spam word lists. Set to false to disable built-in lists.
wordListPaths string|array|null null Custom paths to word list files or directories. Always additive (added to built-in lists if enabled). Can be a single path (string) or multiple paths (array).
spamWords array [] Custom spam words with weights. Format: [weight => ['word1', 'word2']]. Higher weight = stronger spam signal.
Other Options
enabled bool true Enable or disable the plugin globally.
fields array ['message'] Form fields to check for spam. Specify multiple fields to combine them for spam checking (e.g., ['message', 'subject', 'body']).
wordListCache bool true Enable caching of word lists. Set to false to reload word lists on every request (useful for development).
silentReject bool false Reject spam without showing error messages (returns a space character).
debug bool false Enable debug logging. Logs ALL validation attempts with reason, metrics, form data, checked fields, anonymized IP, and timestamp.
debugLogFile string|null null Path to debug log file. Defaults to uniform-spam-words.log in the kirby logs directory (e.g. site/logs/uniform-spam-words.log).
attachDebugInfo bool false Attach spam check data to Form object (accessible via $form->data('spam_words_guard_info')) for use in email templates. Be aware that by default all fields are sent in uniform emails.

Message Rejection & Spam Score

Common Use Cases

Full Configuration Example

Contact Form with Basic Spam Protection

Strict Comment System

Multi-Field Spam Checking

Increase Weight for Links/Emails

Development Mode (No Caching)

Custom Validation with Industry-Specific Terms

Debug Mode for Tuning

Debug logging captures:

Example log entry:

IP Anonymization (GDPR Compliant):

Custom Word Lists

You can use your own spam word list files instead of or in addition to the built-in lists.

File Format

Word list files should be plain text files (.txt) with:

Example file content (my_spam_words_7.txt):

Configuration Options

Single file:

Multiple files:

Directory (loads all .txt files):

Multiple directories:

Combining with Built-in Lists

Custom word lists are added to the built-in lists (if enabled). The options work independently:

Built-in + Custom (default):

Notes

Supported Languages

The plugin includes built-in translations for error messages in the following languages:

The plugin automatically uses the appropriate language based on your Kirby site's language configuration.

Custom Error Messages

Single-language sites: Define custom messages in config.php:

Multi-language sites: Define translations in your language files (site/languages/*.php):

License

This plugin is licensed under the MIT License

Credits

Screenshots

Screenshots use sample content at 1408 × 902 pixels. Panel views are cropped to the content area. The main image uses the light theme.

View Light Dark
Overview Light Dark

The spam rejection previews use the contact form with neutral T-Room styling.


All versions of uniform-spam-words with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
getkirby/composer-installer Version ^1.1
mzur/kirby-uniform Version ^5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tearoom1/uniform-spam-words contains the following files

Loading the files please wait ...