Censorship is a PHP library that covers up undesired words
First, you'll need to load
an array of censored words.
$censorship = new Chaucerbao\Censorship;
$censorship->load(['happy', 'flower']);
$censorship->censor('I am so happy when I get flowers for my birthday!');
// I am so ***** when I get ******* for my birthday!
You can also load words from the constructor
$censorship = new Chaucerbao\Censorship(['happy', 'flower']);
If you prefer to cover the letters with a different symbol, you can use either:
$censorship->setSymbol('-'); // Changes the default symbol for future calls
$censorship->censor('Your sentence.', '-'); // Uses the symbol for this instance only
void load(array $words)
You can change the default symbol (*) used to cover up the letters.
void setSymbol(string $symbol)
Returns the text with the undesired words covered. Passing in a $symbol
will override the default symbol for this call.
string censor(string $text[, string $symbol])