dshumkov / profanity-filter
Profanity filter based on Swearjar library
Installs: 63
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/dshumkov/profanity-filter
Requires
- php: >=5.5
This package is not auto-updated.
Last update: 2025-10-15 15:26:21 UTC
README
Profanity filter based on PHP Swearjar library
Installation
composer require dshumkov/profanity-filter
Usage
Predefined dictionary
$tester = new DShumkov\ProfaneFilter\Tester();
if ($tester->profane('son-of-a-bitch'))
{
return 'bad word detected';
}
Custom dictionary
$dictionary = [
'regex' => ['regex1', 'regex2'],
'word' => ['word1', 'word2'],
'phrase' => ['phrase one', 'phrase two']
];
$tester = new DShumkov\ProfaneFilter\Tester($dictionary);
if ($tester->profane('some string with word1') OR $tester->profane('phrase two'))
{
return 'bad word detected';
}