askedio/laravel5-profanity-filter
Larablocks Analysis
askedio/laravel5-profanity-filter is built for Laravel 5, going by its name (latest release 1.10, Oct 19, 2018), which reached end of life: no more fixes, even for security.
Laravel 5 in earlier releases.
Recommendation checks
Not advisedNot advised: no release or commit in over 2 years.
- No release or commit in over 2 years
- Supports only Laravel 5, past end of life
- No release in the last 12 months (last: Oct 19, 2018)
- 4,361 downloads a month (needs 10,000)
- 52 GitHub stars (needs 100)
State
Likely abandoned- No release or commit in over 2 years.
- Last stable release: Oct 19, 2018.
- No releases in the last 12 months.
- First released: Nov 23, 2016.
- Monthly downloads: 4,361, up 22% from six months ago.
- 4 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Dec 4, 2026.
| Install | |
|---|---|
composer require askedio/laravel5-profanity-filter |
|
| Latest Version: | 1.10 |
| PHP: | >=5.5.9 |
| Older releases: | 5 |
| License: | AGPL-3.0 |
| Last Updated: | Jul 3, 2020 |
| Links: | GitHub · Packagist |
Laravel Profanity Filter
Filter profanity, or other bad words, out of a string using Laravels localization feature or with any PHP application and some custom coding.
Installation
composer require askedio/laravel5-profanity-filter
Register in config/app.php.
Register the service providers in Laravel 5.4 or lower to enable the package:
Askedio\Laravel5ProfanityFilter\Providers\ProfanityFilterServiceProvider::class,
Configure
php artisan vendor:publish
You can edit the default list of words to filter along with the settings in config/profanity.php.
replaceWith can also be a string of chars to be randomly chosen to replace with, like '&%^@#'.
You can create your own list of words, per language, in resources/lang/[language]/profanity.php.
Usage
$string = app('profanityFilter')->filter('something with a bad word');
The $string will contain the filtered result.
You can also define things inline
$string = app('profanityFilter')->replaceWith('#')->replaceFullWords(false)->filter('something with a bad word'));
You can also use the profanity filter with Laravels Validation feature:
$request->validate([
'title' => 'required|profanity|unique:posts|max:255',
]);
Options
-
filter($string = string, $details = boolean)pass a string to be filtered.- Enable details to have an array of results returned:
[ "orig" => "", "clean" => "", "hasMatch" => boolean, "matched" => [] ]
- Enable details to have an array of results returned:
-
reset()resetreplaceWithandreplaceFullWordsto defaults. -
replaceWith(string)change the chars used to replace filtered strings. -
replaceFullWords(boolean)enable to replace full words, disable to replace partial.
Profanity Filter with PHP
You can also use this package without Laravel.
use Askedio\Laravel5ProfanityFilter\ProfanityFilter;
$config = []; // Data from `resources/config/profanity.php`
$badWordsArray = []; // Data from `resources/lang/[lang]/profanity.php`
$profanityFilter = new ProfanityFilter($config, $badWordsArray);
$string = $profanityFilter->filter('something with a bad word');
Credits
This package is based on banbuilder.
Related Packages
Powerful PHP database abstraction layer (DBAL) with many features for database s...
Laravel Serializable Closure provides an easy and secure way to serialize closur...
Cli error handling for console/command-line PHP applications.
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 1.10 | >=5.5.9 | AGPL-3.0 | ||
| 1.0.9 | >=5.5.9 | AGPL-3.0 | ||
| 1.0.6 | >=5.5.9 | AGPL-3.0 | ||
| 1.0.5 | >=5.5.9 | AGPL-3.0 | ||
| 1.0.4 | >=5.5.9 | AGPL-3.0 | ||
| 1.0.3 | >=5.5.9 | 5.* | MIT |