blaspsoft/blasp
Advanced profanity filtering for Laravel with driver-based detection (regex/pattern/phonetic/pipeline), multi-language support, severity scoring (0–100), configurable masking, Eloquent trait auto-sanitizing, middleware and validation rules, plus events and testing fakes.
ProfanityDetected, ModelProfanityDetected) enables reactive workflows (e.g., logging, analytics, or custom notifications).Blasp::check()).CheckProfanity middleware handles request sanitization/rejection with configurable severity thresholds.Blaspable trait automates model-level checks, ideal for comment systems, user-generated content, or moderation workflows.max_distance_ratio (default: 0.6) may misclassify slang or niche terms. Customize false_positives or extend the driver.regex + phonetic). Defaults may not suit all use cases (e.g., strict moderation vs. lenient forums).f-u-c-k, phuck) be tested in CI?composer require with optional publishing for config/languages. No runtime dependencies beyond Laravel core.blasp_check validation rules for critical fields (e.g., comments, bios).blasp:sanitize to API routes handling user-generated content.Blasp::check() execution time).Blaspable trait to models requiring sanitization (e.g., Post, Message).str_replace() with @clean for safe output rendering.CustomDriver for internal jargon).cache.results for high-frequency inputs (e.g., search queries).drivers.pipeline to balance accuracy and performance (e.g., ['pattern', 'phonetic'] for speed).Illuminate\Contracts\Container\BindingResolutionException).metaphone (for phonetic driver) may require intl extension. Document requirements in composer.json.spatie/laravel-profanity-filter). Audit dependencies for overlaps.| Phase | Task | Priority | Dependencies |
|---|---|---|---|
| Discovery | Audit existing profanity handling (regex, allow lists). | High | None |
| Validation | Add blasp_check to critical validation rules. |
High | Package installed |
| Middleware | Apply blasp:sanitize to API routes. |
Medium | Validation working |
| Eloquent | Add Blaspable trait to models. |
Medium | Middleware tested |
| Blade | Replace manual sanitization with @clean directive. |
Low | Eloquent integration verified |
| Customization | Extend drivers/allow lists for edge cases. | Low | Core features stable |
| Monitoring | Log false positives/negatives and performance metrics. | Ongoing | All features implemented |
blasp.php to customize defaults (e.g., languages, severity, masking).blasp_allow_list table). Implement a Blasp::syncAllowList() method if needed.f*ck). Monitor GitHub issues for pattern improvements.false_positives list may require maintenance for new slang.Result methods (uniqueWords(), words()) aid debugging. Log Blasp::check($text)->toArray() for troubleshooting.ProfanityDetected to log flagged content for review.allow list).Blasp::check()->score() to users for transparency (e.g., "This comment scored 85/100 for profanity").f-u-c-k).Blasp::checkMany() for bulk operations (e.g., importing user data).cache.results for repeated inputs (e.g., API responses,How can I help you explore Laravel packages today?