PHP code example of kamu / aman

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

    

kamu / aman example snippets


    return [
        'badword1',
        'badword2',
        // Add more words you want to filter
    ];
    

    use Kamu\Aman;

    $text = "This is an example with bad words.";
    $filter = Aman::factory();

    if ($filter->check($text)) {
        echo "This text contains profanity.";
    } else {
        echo "This text is clean.";
    }
    

    $text = "This is an example with bad words.";
    $maskedText = $filter->masking($text, '*');
    echo $maskedText; // Output: "This is an example with *** ****."
    

    $text = "This is an example with bad words.";
    $cleanText = $filter->filter($text);
    echo $cleanText; // Output: "This is an example with ."
    

    $text = "This is an example with bad words.";
    $badWords = $filter->words($text);
    print_r($badWords); // Output: ['bad', 'words']