Laravel Blacklist
Laravel Blacklist: A robust content filtering solution for Laravel applications that provides comprehensive validation against unwanted user input. This package offers dual-layer protection with both system blacklist words (preventing username squatting and system impersonation) and profanity/offensive terms filtering.
Key features:
- Intelligent Word Boundary Matching: Prevents false positives while catching problematic content.
- Flexible Filtering Modes: Use system blacklist only, profanity filtering only, or both simultaneously.
- Advanced Matching Strategies:
- Exact: Whole word matching (default).
- Fuzzy: Catch typos using Levenshtein distance (e.g., "admin" matches "adm1n").
- Substitution: Catch "leet speak" substitutions (e.g., "h3ll0").
- Context-Aware Validation: Define different validation rules for different fields (e.g., stricter rules for usernames vs comments).
- Whitelist & Ignore Patterns: Globally whitelist terms or use regex to ignore specific patterns.
- Customizable Word Lists: Easily extend or modify lists via configuration.
- Detailed Error Messages: Users receive context-aware validation feedback.
- Built-in Security Logging: Support for custom log channels.
- Simple Integration: Works with Laravel controllers, Livewire components, and forms.
- Zero Dependencies: Lightweight and efficient.
- Optional Logging Support: Pass a custom log channel to capture violations or auditing.
Perfect for applications requiring content moderation, user registration systems, comment sections, or any user-generated content that needs protection against inappropriate language or system term abuse.