Download the PHP package cledilsonweb/badwords without Composer
On this page you can find all versions of the php package cledilsonweb/badwords. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cledilsonweb/badwords
More information about cledilsonweb/badwords
Files in cledilsonweb/badwords
Package badwords
Short Description Badwords PHP is a small lightweight PHP library for detecting 'bad' words, e.g. profanity, in content.
License MIT
Informations about the package badwords
Badwords PHP
Badwords PHP is small lightweight PHP library for detecting "bad" words, e.g. profanity, in content. This is a fork from mioga-technik/badwords to customize.
Aside from the obvious matching if a word is present in a string, the filter also tries to detect words similar to those in the list, e.g. gl@d
and glad
.
The library is designed to be highly configurable, from the word lists used to the character replacement configuration at the heart of the filter.
Note: At present the default configuration provided is not a bulletproof/catch-all solution, but it will catch most variations. This will become more robust over time.
Requirements
- The library is only supported on PHP 5.6 and up.
- Composer is required.
Installation
To install include it in your projects's composer.json
.
There are no additional dependencies required for this package to work.
Usage
File Method:
The simplest way to use the library is as follows,
Explained,
- First load your list of "bad" words using the
Dictionary
objects, or create your own and implement theDictionary
interface. - Define a configuration for the filter to use (a default
Standard
configuration is provided). - Create the
Filter
passing your dictionary(s) and config. - Filter your content using the
filter()
method. - Use the
Result
object to analyse your content.
Array Method:
Object Layer Method [new]:
Testing
To run the unit tests on this package, simply run vendor/bin/phpunit
from the package directory.
Credits
- This repository is maintained by Cledilson Nascimento
Previous authors:
- Update Repository and push it to packagist by Brian Schäffner.
- Written and developed by Stephen Melrose.
- Original concept by Paul Lemon.