Laravel Packages

Blasp is a Profanity Filter Package for Laravel

Published
Blasp is a Profanity Filter Package for Laravel image

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.

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Sponsored

laravelcloud logo
Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Visit Laravel Cloud

The latest

View all →
Pause All Laravel Queues During a Deploy image

Pause All Laravel Queues During a Deploy

Read article
Laravel Terminal UI for the artisan dev Command image

Laravel Terminal UI for the artisan dev Command

Read article
Pause All Queues and a New artisan dev UI in Laravel 13.25 image

Pause All Queues and a New artisan dev UI in Laravel 13.25

Read article
Laravel monitoring that doesn't bill you by your traffic image

Laravel monitoring that doesn't bill you by your traffic

Read article
Mock PHP Classes in Tests With the Double Library image

Mock PHP Classes in Tests With the Double Library

Read article
Laravel Discount: Coupon Codes, Usage Limits, and Stacking image

Laravel Discount: Coupon Codes, Usage Limits, and Stacking

Read article