1. Go to this page and download the library: Download omalie/kata-kotor 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/ */
omalie / kata-kotor example snippets
return [
/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| Bahasa default untuk memfilter kata kotor. Contoh: 'id' = Indonesia,
| 'en' = English. Bisa di-override saat penggunaan.
|
*/
'default_language' => 'id',
];
use OmAlie\KataKotor\Facades\KataKotor;
class MessageController extends Controller
{
public function sendMessage(Request $request)
{
$message = $request->input('message');
if (KataKotor::hasBadwords($message)) {
return response()->json([
'error' => 'Message has bad word!'
], 400);
}
// Lanjut proses...
}
}