blaspsoft/blasp
Advanced profanity filtering for Laravel with driver-based detection (regex/pattern/phonetic/pipeline), multi-language support, severity scoring (0–100), masking strategies, validation rules, middleware, Eloquent model integration, events, and test fakes.
regex, pattern, phonetic, pipeline) aligns well with Laravel’s extensibility, allowing TPMs to customize detection logic without monolithic refactoring. The pipeline driver (chaining multiple drivers) is particularly valuable for balancing precision and performance.ProfanityDetected, ModelProfanityDetected) allows for observability and side effects (e.g., logging, analytics) without polluting business logic.Blasp::check()->mask()->in('spanish')) mirrors Laravel’s query builder and validation patterns, reducing cognitive load for developers.@clean($text) in views).metaphone() + Levenshtein distance, which can be slow for short words. Configure min_word_length to mitigate.regex + phonetic) compounds cost. Benchmark in staging before production.false_positives config or allow() lists.f-u-u-u-c-k). Extend with custom drivers if needed.cache.results: true), but invalidation requires manual handling for dynamic content.blasp middleware applies to all routes by default. Explicitly exclude sensitive endpoints (e.g., /admin) to avoid unintended blocking.regex driver be viable, or should we default to pattern + phonetic?pattern driver for most checks.composer update or integrate with a moderation API?****) or rejected (422 error)? Context-dependent (e.g., reject in public forums, mask in moderated spaces).Blaspable trait for model-level checks.blasp_check rule or Profanity fluent object.blasp:sanitize or blasp:reject for HTTP requests.@clean directive for views.mbstring for Unicode support and pcntl for parallel processing (if batch-checking many texts).pattern driver, mild severity) and tighten as needed.config/blasp-local.php for dev).Str/Stringable macros.php artisan vendor:publish --tag="blasp".default driver, language, and mask in .env.blasp_check to form requests.$request->validate([
'comment' => ['required', 'blasp_check:spanish,high'],
]);
middleware('blasp:sanitize').config/blasp.php:
'middleware' => [
'except' => ['password', 'api_token'],
],
use Blaspsoft\Blasp\Blaspable; to models.blaspable attributes and blaspMode (e.g., reject for public posts).{{ $comment->body }} with @clean($comment->body).ProfanityDetected events.blasp middleware errors in Sentry/Error Tracking.composer update blaspsoft/blasp or manual config edits.str_contains).BLASP_DRIVER=pattern in production).@clean, blasp_check).pattern for speed, regex for accuracy").allow() lists.How can I help you explore Laravel packages today?