PHPackages                             particleflux/yii2-blocklist-validator - 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. particleflux/yii2-blocklist-validator

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

particleflux/yii2-blocklist-validator
=====================================

Validate attributes against a blocklist

0.2.0(1y ago)02.1k↓66.7%MITPHPPHP ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0CI passing

Since Oct 25Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/particleflux/yii2-blocklist-validator)[ Packagist](https://packagist.org/packages/particleflux/yii2-blocklist-validator)[ RSS](/packages/particleflux-yii2-blocklist-validator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (8)Versions (5)Used By (0)

yii2-blocklist-validator
========================

[](#yii2-blocklist-validator)

[![Packagist Version (custom server)](https://camo.githubusercontent.com/07d751a8e73f8129a0edc25fc0f64d419a54ff728543f8a63dfb2cca03766af8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7061727469636c65666c75782f796969322d626c6f636b6c6973742d76616c696461746f72)](https://camo.githubusercontent.com/07d751a8e73f8129a0edc25fc0f64d419a54ff728543f8a63dfb2cca03766af8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7061727469636c65666c75782f796969322d626c6f636b6c6973742d76616c696461746f72)[![Packagist PHP Version](https://camo.githubusercontent.com/788ba169cd42ef7da715e1613d2fc2cceb66c730dd0a90f343c713bb69e1c4de/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f7061727469636c65666c75782f796969322d626c6f636b6c6973742d76616c696461746f722f706870)](https://camo.githubusercontent.com/788ba169cd42ef7da715e1613d2fc2cceb66c730dd0a90f343c713bb69e1c4de/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f7061727469636c65666c75782f796969322d626c6f636b6c6973742d76616c696461746f722f706870)[![build](https://github.com/particleflux/yii2-blocklist-validator/actions/workflows/tests.yml/badge.svg)](https://github.com/particleflux/yii2-blocklist-validator/actions/workflows/tests.yml/badge.svg)[![codecov](https://camo.githubusercontent.com/6f174d4d2939937b3b0ae73160c6c8dcccd3df878dd7bd541504be10c83b41af/68747470733a2f2f636f6465636f762e696f2f67682f7061727469636c65666c75782f796969322d626c6f636b6c6973742d76616c696461746f722f67726170682f62616467652e7376673f746f6b656e3d323854324e5255303659)](https://codecov.io/gh/particleflux/yii2-blocklist-validator)

A Yii2 validator to block certain values

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

[](#installation)

```
composer require particleflux/yii2-blocklist-validator
```

Usage
-----

[](#usage)

### BlockListFileValidator

[](#blocklistfilevalidator)

Block attribute values contained in a file.

```
public function rules(): array
{
    return [
        ['username', BlockListFileValidator::class, 'file' => '@app/config/bad-usernames.txt'],
    ];
}
```

Some of the behavior can be fine-tuned:

```
public function rules(): array
{
    return [
        [
            'username',
            BlockListFileValidator::class,
            'file' => '@app/config/bad-usernames.txt'   // the path to the blocklist file, can contain aliases
            'strict' => true,           // whether to do strict comparison (default: false)
            'useCache' => true,         // use cache component defined in 'cache' (default: true)
            'cacheTtl' => 60,           // cache TTL (default: null, meaning the component default)
            'cache' => 'customCache',   // cache component to use (default 'cache')
        ],
    ];
}
```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance54

Moderate activity, may be stable

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~132 days

Total

4

Last Release

539d ago

PHP version history (4 changes)0.0.1PHP ^8.1.0 || ^8.2.0

0.0.2PHP ~8.1.0 || ~8.2.0

0.1.0PHP ~8.1.0 || ~8.2.0 || ~8.3.0

0.2.0PHP ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3686454?v=4)[Stefan Linke](/maintainers/particleflux)[@particleflux](https://github.com/particleflux)

---

Top Contributors

[![particleflux](https://avatars.githubusercontent.com/u/3686454?v=4)](https://github.com/particleflux "particleflux (48 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/particleflux-yii2-blocklist-validator/health.svg)

```
[![Health](https://phpackages.com/badges/particleflux-yii2-blocklist-validator/health.svg)](https://phpackages.com/packages/particleflux-yii2-blocklist-validator)
```

###  Alternatives

[borales/yii2-phone-input

Yii2 International telephone numbers - Asset Bundle, Behavior, Validator, Widget

1341.6M6](/packages/borales-yii2-phone-input)[codeonyii/yii2-at-least-validator

Validates at least one (or more) attributes.

28253.5k1](/packages/codeonyii-yii2-at-least-validator)[arogachev/yii2-many-to-many

Many-to-many ActiveRecord relation for Yii 2 framework

3541.2k4](/packages/arogachev-yii2-many-to-many)[yiibr/yii2-br-validator

Provide validations and features for brazilian localization

14103.2k4](/packages/yiibr-yii2-br-validator)[yii2mod/yii2-validators

Collection of useful validators for Yii Framework 2.0

1816.8k](/packages/yii2mod-yii2-validators)

PHPackages © 2026

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