PHP code example of askedio / laravel5-profanity-filter

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

    

askedio / laravel5-profanity-filter example snippets


$string = app('profanityFilter')->filter('something with a bad word');

$string = app('profanityFilter')->replaceWith('#')->replaceFullWords(false)->filter('something with a bad word'));

$request->validate([
    'title' => '

    [
      "orig" => "",
      "clean" => "",
      "hasMatch" => boolean,
      "matched" => []
    ]
    

use Askedio\Laravel5ProfanityFilter\ProfanityFilter;

$config = []; // Data from `resources/config/profanity.php`
$badWordsArray = []; // Data from `resources/lang/[lang]/profanity.php`

$profanityFilter =  new ProfanityFilter($config, $badWordsArray);
$string = $profanityFilter->filter('something with a bad word');

php artisan vendor:publish