1. Go to this page and download the library: Download coxlr/laravel-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/ */
coxlr / laravel-profanity example snippets
$cleansedText = Profanity::clean('Using the facade to cleanse a string.');
/*
This function returns a string with any profanity found replaced with replace value set in the config.
*/
$profanity = app('profanity');
$cleansedText = $profanity->clean('Using the instance to cleanse a string.');
$isClean = Profanity::isClean('The string to be checked.');
/*
This function returns a boolean value. If the string is clean, it will return true. If the string contains profanity, it will return false.
*/
$cleansedText = Profanity::setLanguages('en,es,fr')->clean('The string to be cleansed.');
$cleansedText = Profanity::setStrict(true)->clean('The string to be cleansed.');
$isClean = Profanity::setStrict(true)->isClean('The string to be checked.');