profile

Professional Laravel & PHP Web Developer in Bangladesh

I am Md Arman Ali, a Professional Laravel & Full Stack Web Developer in Bangladesh and Cyber Security Specialist with 4 years 2 months of experience building secure, scalable and high-performance web applications.

Book A call
blog-img-1

Blasp is a Profanity Filter Package for Laravel

Blasp is a Laravel profanity filter package that helps detect and mask profane words. It provides profanity detection, substitution options, obfuscation, and more.

use Blaspsoft\Blasp\Facades\Blasp;
 
$sentence = 'Laravel News kicks ass!';
$blasp = Blasp::check($sentence);
 
$blasp->getSourceString(); // "Laravel News kicks ass!"
$blasp->getCleanString(); // "Laravel News kicks ***!"
$blasp->hasProfanity(); // true
$blasp->getProfanitiesCount(); // 1
$blasp->getUniqueProfanitiesFound(); // ['ass']

Besides straight matches, this package also matches various like substitution (i.e., a$$), obscured profanity (i.e., a-s-s), repeated letters, and combinations of all of them. Along with the Blasp facade, this package provides a validation rule you can use to validate form input for profanity:

$validated = $request->validate([
'sentence' => ['blasp_check'],
]);
 
// If the sentence contains profanities, validation will fail.

You can learn more about this package, get full installation instructions, and view the source code on GitHub.

Related Post

banner-shape-1
banner-shape-1
object-3d-1
object-3d-2

Chat Support

×