PHP code example of lakshanjs / profanity-filter
1. Go to this page and download the library: Download lakshanjs/profanity-filter library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lakshanjs / profanity-filter example snippets
use LakshanJS\ProfanityFilter\ProfanityFilter;
$filter = new ProfanityFilter();
$filter->setBadWords(['badword1', 'badword2']);
$filter->setReplacementChar('*');
$filteredMessage = $filter->censor("This is a badword1");
echo $filteredMessage; // Output: This is a ******