PHP code example of consoletvs / profanity

1. Go to this page and download the library: Download consoletvs/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/ */

    

consoletvs / profanity example snippets


$clean_words = Profanity::blocker('My cool string bitch')->filter()

// My cool string *****

ConsoleTVs\Profanity\ProfanityServiceProvider::class,

'Profanity' => ConsoleTVs\Profanity\Facades\Profanity::class,

$words = 'My bad word bitch';
$clean_words = \ConsoleTVs\Profanity\Builder::blocker($words)->filter();
// My bad word *****

// Filter words only by English and German bad words.
$clean_words = \ConsoleTVs\Profanity\Builder::blocker($words, languages: ['en', 'de'])->filter();



namespace App\Http\Controllers;

use Illuminate\Http\Request;
use ConsoleTVs\Profanity\Facades\Profanity;
// or using the alias:
// use Profanity;

class HomeController extends Controller
{
    /**
     * Simple test function.
     *
     * @return string
     */
    public function test()
    {
        $words = 'My bad word bitch';

        return Profanity::blocker($words)->filter();
        // My bad word *****
    }
}
config/app.php