PHP code example of afrizalmy / bad-word-indonesia

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

    

afrizalmy / bad-word-indonesia example snippets


// import terlebih dahulu
use afrizalmy\BWI\BadWord;

echo BadWord::cek('dasar, bajingan kamu ya!');
// true

echo BadWord::masking('dasar, bangsat kamu ya!');
// dasar, b*ngs*t kamu ya!

echo BadWord::masking('dasar, keparat kamu ya!', '#');
// dasar, k#p#r#t kamu ya!

echo BadWord::masking('dasar, baaaaajiiiingaannn');
// dasar, b*****j****ng**nnn

/**
 * Custom word rules
 * **/
echo BadWord::masking('Yekkk masih belajar pehape wkwk', "*", ['pehape','php']);
// Yekkk masih belajar p*h*p* wkwk
bash
vendor\bin\phpunit test\BadWordTest.php