1. Go to this page and download the library: Download heyitsmi/content-guard 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/ */
heyitsmi / content-guard example snippets
use Heyitsmi\ContentGuard\Facades\ContentGuard;
// 1. Check if text contains bad words (returns boolean)
$isSpam = ContentGuard::hasBadWords("Ayo main s10t g4c0r hari ini!");
if ($isSpam) {
return back()->withErrors(['message' => 'Your comment contains restricted content.']);
}
// 2. Sanitize text (returns clean string)
$cleanText = ContentGuard::sanitize("Jangan main judi online!");
// Output: "Jangan main **** ******!"
use Heyitsmi\ContentGuard\ContentGuard;
$guard = new ContentGuard();
$input = "Situs g.a.c.o.r terpercaya";
if ($guard->hasBadWords($input)) {
echo "Spam detected!";
}
echo $guard->sanitize($input);
$text = "Bocoran slot gacor hari ini";
// Default is 'blur'
echo ContentGuard::wrap($text);
// Or use 'mask' for a solid black box
echo ContentGuard::wrap($text, 'mask');