1. Go to this page and download the library: Download crudleapps/profanity 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/ */
crudleapps / profanity example snippets
use Crudle\Profanity\Filter;
use Crudle\Profanity\Dictionary\GB;
$filter = new Filter(new GB);
// Clean a string
$filter->cleanse('Joe is a little bitch'); // Returns 'Joe is a little *****'
// Clean a string with a custom censor character
$filter->cleanse('Joe is a little bitch', 'x'); // Returns 'Joe is a little xxxxx'
// Check if a string is dirty
$filter->isDirty('Joe is a little bitch'); // Returns true
class MyDictionary extends AbstractDictionary
{
protected $badWords = [
'bollocks',
'twat'
];
}
$filter = new Filter(new MyDictionary);
$dictionary = new GB();
$dictionary->add(['dicks', 'bitches']);
// Alternatively, clear the existing words in the dictionary if you want to start fresh
$dictionary->clear();
$dictionary->add(['ho', 'testicle']);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.