dexterdr/censored

A simple library for searching and removing obscene vocabulary.

v1.0.2 2019-05-07 08:52 UTC

This package is auto-updated.

Last update: 2025-03-07 21:17:17 UTC


README

Packagist Version PHPStan Packagist

A simple library for searching and removing obscene vocabulary.

Currently there are dictionaries only for English and Russian languages.

use Censored\Censored;

$text = 'String to validate...';
$censored = new Censored();

$censored->isAcceptable($text);  // true
$censored->setLanguages(['en', 'ru']);
$censored->setExactMatch(false);
$censored->getProhibitedWordsCount($text);  // 0

Installation

$ composer require dexterdr/censored
{
    "require": {
        "dexterdr/censored": "^1.0"
    }
}
<?php
require 'vendor/autoload.php';

use Censored\Censored;

$censored = new Censored(['en', 'ru'], false);