Download the PHP package waad/laravel-profanity-filter without Composer
On this page you can find all versions of the php package waad/laravel-profanity-filter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download waad/laravel-profanity-filter
More information about waad/laravel-profanity-filter
Files in waad/laravel-profanity-filter
Package laravel-profanity-filter
Short Description Laravel Profanity Filter - Powerful PHP package for detecting, filtering, and masking profanity in multiple languages. Supports leet speak, custom word lists, case sensitivity, and seamless Laravel integration.
License MIT
Homepage https://github.com/waad/laravel-profanity-filter
Informations about the package laravel-profanity-filter
Laravel Profanity Filter
A powerful, flexible, and easy-to-use PHP Laravel package for detecting, filtering, and masking profanity in multiple languages. Includes advanced features such as leet speak detection, custom word lists, language auto-detection, and real-time configuration.
🚀 Features
- Multi-language support: Detects profanity in English, French, Arabic, and more
- Customizable masking: Replace profane words with your own masking character(s)
- Leet speak & substitutions: Detects obfuscated words (e.g., "f@ck", "sh!t", "d4mn")
- Custom word lists: Add or override profane words per language
- Case sensitivity: Toggle case-sensitive or insensitive detection
- Separator handling: Detects words with separators (e.g., d-a-m-n, s_h_i_t)
- Laravel integration: Seamless usage via Facade, Service Provider, and config
- Real-time configuration: Update settings and word lists at runtime
- Extensible: Easily add new languages, separators, or substitutions
- Import custom words from files: Load additional profanity words from
.txtor.jsonfiles per language
🛠 Requirements
PHP 8.0+Laravel 8+
Installation
Via Composer
Publish the configuration file:
Publish the words (Optional) ⚠️:
Configuration
You can configure the package by editing the profanity-filter.php file in the config directory.
Usage
Using hasProfanity method
Using filter method
Using getProfanityWords method
Using setLanguage method
Using setCaseSensitive method
Using setDetectLeetSpeak method
Using setConfig method
You can update the package configuration in real time using Laravel's config() helper, or by editing the profanity-filter.php file in the config directory.
Using importWordsFromFile method
You can import additional profanity words from a file (JSON or TXT) at runtime using the importWordsFromFile method. This is useful for dynamically extending the list of profane words without modifying the config file.
Using addWords method
You can add custom profanity words in real time using the addWords method. This is useful for dynamically adding words without modifying the config file.
Using removeWords method
You can remove profanity words from the filter in real time using the removeWords method.
Using clearWords method
You can clear all profanity words for a specific language in real time using the clearWords method.
Using getWords method
You can retrieve all profanity words for a specific language using the getWords method.
Example All Methods
Contributing
Contributions are welcome! Please feel free to submit a pull request.
Testing
To run the tests, you can use the following command:
To Do
- [x] Add support for multiple languages
- [x] Add support for custom words
- [x] Add support for leet speak
- [x] Add support for case sensitivity
- [x] Add support for separators
- [x] Add support for custom replacements
- [x] Add support for custom separators
- [x] Add support for custom substitutions
- [x] Add support for custom word lists
- [x] Add support for custom word lists per language
- [x] Add support for custom word from files (json, txt)
- [x] Add support for custom word lists in real time
License
This package is open-sourced software licensed under the MIT license.