PHPackages                             accentinteractive/laravel-disallowlister - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. accentinteractive/laravel-disallowlister

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

accentinteractive/laravel-disallowlister
========================================

Validate data against one or multiple disallowlists, using the built-in Laravel validator or by calling the facade directly. Supports wildcards.

v0.4.0(4y ago)19MITPHPPHP ^7.3|^8.0

Since Aug 23Pushed 4y ago1 watchersCompare

[ Source](https://github.com/accentinteractive/laravel-disallowlister)[ Packagist](https://packagist.org/packages/accentinteractive/laravel-disallowlister)[ Docs](https://github.com/accentinteractive/laravel-disallowlister)[ RSS](/packages/accentinteractive-laravel-disallowlister/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (6)Used By (0)

Disallowlister for Laravel.
===========================

[](#disallowlister-for-laravel)

Effortlessly test strings against any array of disallowed strings. Supports `fnmatch` wildcards, like \* and ?.

`accentinteractive/disallowlister` contains both a facade `Disallowlister` and custom validation rule `disallowlister`. You can set a default array of disallowed strings in config, or add and remove disallowed strings using `Disallowlister:add()` and `Disallowlister:remove()`

[![Latest Version on Packagist](https://camo.githubusercontent.com/50bb4be1eaeb6f13f91894d83eddcd3962667efbad9011730dc671154ad394b7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616363656e74696e7465726163746976652f6c61726176656c2d646973616c6c6f776c69737465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/accentinteractive/laravel-disallowlister)[![Build Status](https://camo.githubusercontent.com/1ca9ff409374a4c5c1111b1366f8f5665da1934a185fc39fc1c2b8cb60320c1c/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f616363656e74696e7465726163746976652f6c61726176656c2d646973616c6c6f776c69737465722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/accentinteractive/laravel-disallowlister)[![Quality Score](https://camo.githubusercontent.com/b2067a678144eb447526b111a29ed1081c3f2e489947ef16894566b526a67343/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f616363656e74696e7465726163746976652f6c61726176656c2d646973616c6c6f776c69737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/accentinteractive/laravel-disallowlister)[![Total Downloads](https://camo.githubusercontent.com/45b717730c63cf83e13730c3c811d797b162bb8c7da6b111eae68483d7397ed0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616363656e74696e7465726163746976652f6c61726176656c2d646973616c6c6f776c69737465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/accentinteractive/laravel-disallowlister)

This Laravel-specific package tests a string against a disallowlist. It is a Laravel implementation of the platform agnostic `accentinteractive/disallowlister`.

If you are looking for a framework agnostic implementation, see

For a list of all options, see .

The `isDisallowed()` method can use wildcards, like \* and ?.

Under the hood, `accentinteractive/disallowtester` uses `fnmatch()`, so you can use the same wildcards as in that php function (the globbing wildcard patterns):

- `*sex*` disallows **sex**, **sex**uality and bi**sex**ual.
- `cycle*` disallows cycle and cycles, but not bicycle.
- `m[o,u]m` disallows mom and mum, but allows mam.
- `m?n` disallows man and men, but allows moon.
- [Installation](#installation)
- [Examples](#usage)
- [Config settings](#config-settings)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require accentinteractive/laravel-disallowlister
```

Optionally you can publish the config file with:

```
php artisan vendor:publish --provider="Accentinteractive\LaravelDisallowlister\LaravelDisallowlisterServiceProvider" --tag="config"

```

Usage
-----

[](#usage)

### Set the disallowlist in config

[](#set-the-disallowlist-in-config)

1. Publish the config file, running `php artisan vendor:publish --provider="Accentinteractive\LaravelDisallowlister\LaravelDisallowlisterServiceProvider" --tag="config"`
2. Set an default array of disalllowed strings in `disallowlister.lists.default`
3. If you wish to use more than one disallowlist, you can add additional arrays of disalllowed strings to `disallowlister.lists`, like `disallowlister.lists.my_list`

### Use the disallowlister validation rule

[](#use-the-disallowlister-validation-rule)

By default, the validator uses the default disallow list.

```
// Use the disallowlist validator with the default disallowlist.
$rules = [
    'user_input' => 'disallowlister'
];
```

However, you can also pass to the validator which disallowlist to use.

```
// Use the disallowlist validator with the my_list disallowlist.
$rules = [
    'user_input' => 'disallowlister:default',
    'user_emails' => 'disallowlister:my_email_list'
];
```

### Case sensitivity

[](#case-sensitivity)

By default, matching is not case sensitive. You can set case sensitivity in confg

```
config(['disallowlister.is_case_sensitive' => true]);
```

### Whole word checking

[](#whole-word-checking)

By default the entire string is checked. You can set to check word for word in config.

```
config(['disallowlister.match_word_for_word' => true]);
```

### Use the class directly

[](#use-the-class-directly)

```
use Accentinteractive\LaravelDisallowlister\Facades\Disallowlister;

// Call the facade directly, using the default disallowlist
DisallowLister::isDisallowed('Earn $4,000 A DAY working from HOME!!!');

// Call the facade directly, using a specific disallowlist
DisallowLister::setDisallowList(config('disallowlister.lists.mylist'))
              ->isDisallowed('Earn $4,000 A DAY working from HOME!!!');

// Add and remove items on the facade
DisallowLister::add('foo')
              ->add(['*bar*', 'b?t'])
              ->remove('b?t')
              ->isDisallowed('Earn $4,000 A DAY working from HOME!!!');
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Joost van Veen](https://github.com/accentinteractive)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

5

Last Release

1720d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/356020?v=4)[Accent Interactive](/maintainers/accentinteractive)[@accentinteractive](https://github.com/accentinteractive)

---

Top Contributors

[![joostvanveen](https://avatars.githubusercontent.com/u/540294?v=4)](https://github.com/joostvanveen "joostvanveen (10 commits)")[![accentinteractive](https://avatars.githubusercontent.com/u/356020?v=4)](https://github.com/accentinteractive "accentinteractive (2 commits)")

---

Tags

accentinteractivelaravel-disallowlister

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/accentinteractive-laravel-disallowlister/health.svg)

```
[![Health](https://phpackages.com/badges/accentinteractive-laravel-disallowlister/health.svg)](https://phpackages.com/packages/accentinteractive-laravel-disallowlister)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[laravel/ui

Laravel UI utilities and presets.

2.7k134.9M601](/packages/laravel-ui)[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[wendelladriel/laravel-validated-dto

Data Transfer Objects with validation for Laravel applications

759569.4k13](/packages/wendelladriel-laravel-validated-dto)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[sammyjo20/lasso

Lasso - Asset wrangling for Laravel made simple.

355347.9k](/packages/sammyjo20-lasso)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
