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

serpapi logo
SerpApi

The Web Search API for Your LLM and AI Applications

Visit SerpApi

The latest

View all →
Sidecar Brings Statamic's Control Panel to Your Existing Markdown Sites image

Sidecar Brings Statamic's Control Panel to Your Existing Markdown Sites

Read article
Collections chunkBy() and Storage Path Hardening in Laravel 13.30 image

Collections chunkBy() and Storage Path Hardening in Laravel 13.30

Read article
Forte: Parse and Rewrite Laravel Blade Templates image

Forte: Parse and Rewrite Laravel Blade Templates

Read article
Compoships: Eloquent Relationships on Multiple Columns image

Compoships: Eloquent Relationships on Multiple Columns

Read article
MKSine: A Filament CMS with Plugins, Themes, and Blocks image

MKSine: A Filament CMS with Plugins, Themes, and Blocks

Read article
Cancel In-Flight Form Submissions in Inertia.js v3.7 image

Cancel In-Flight Form Submissions in Inertia.js v3.7

Read article