PHPackages                             nikolai/char-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. nikolai/char-validator

ActiveYii2-extension

nikolai/char-validator
======================

A char validator that validates string by chosen conditions.

v1.0(5y ago)01MITPHP

Since Jan 28Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Nikolai-ln/char-validator)[ Packagist](https://packagist.org/packages/nikolai/char-validator)[ RSS](/packages/nikolai-char-validator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

char-validator
==============

[](#char-validator)

A char validator for Yii2 that validates string by chosen conditions. Inspired by nickcv -  and his extension for Yii 1.1 - !

[![License](https://camo.githubusercontent.com/1e1cb7bae9fc55a01fc5443d26e358dc21c129253bcfa9841db85c4f25aa2ecf/687474703a2f2f696d672e736869656c64732e696f2f3a6c6963656e73652d6d69742d626c75652e7376673f7374796c653d666c61742d737175617265)](http://doge.mit-license.org)

Requirements
------------

[](#requirements)

- Yii2 &gt;= 2.0
- Composer for installation

#### Installation

[](#installation)

```
composer require nikolai/char-validator

```

#### Usage

[](#usage)

To use char-validator, install it via Composer, add the new class in the model and then use it in the rules. There are additional parameters that can be used in validation. An example of using with some parameters, also usage of "extra".

```
use nln\chars\CharValidator;
...
public function rules() {
        return [
            [['name'], CharValidator::className(), 'allAccentedLetters' => true, 'allowSpaces'=> true],
            [['differentname'], CharValidator::className(), 'allAccentedLetters' => true, 'allowSpaces'=> true, 'extra' => array('.', '-', '(', ')', '\'')],
        ];
    }
```

- `allowNumbers` is a boolean, and defaults to false. Allow the use of numbers into the string.
- `allowSpaces` is a boolean and defaults to false. the name is pretty self explanatory.
- `minChars` is an integer and defaults to 1.
- `maxChars` is still an integer and defaults to NULL. If you don't want the validated string to have more then x characters use this parameter.
- `accentedLetters` is another boolean. Enables the use of basic accented vowels into the string. See the list below.
- `allAccentedLetters` still a boolean. Enable the use of every accented letter existing in the latin-derived languages. See the list below.
- `extra` this is an array. If you want to allow some other characters (like -) this is the parameter you want to use.
- `message` just like any other validator you can use this to change the error message. You can use {attribute} in this string as a wild card if you want to.

### accentedLetters list

[](#accentedletters-list)

ÀÁÂÃÄĀĂÈÉÊËĚĔĒÌÍÎÏĪĨĬÒÓÔÕÖŌÙÚÛÜŪŬŨàáâãäāăèéêëēěĕ ìíîïīĩĭòóôõöōŏùúûüūŭũ

### allAccentedLetters list

[](#allaccentedletters-list)

ÀÁÂÃÄÅĀĄĂÆÇĆČĈĊĎĐÈÉÊËĒĘĚĔĖĜĞĠĢĤĦÌÍÎÏĪĨĬĮİĲĴĶŁĽĹĻ ĿÑŃŇŅŊÒÓÔÕÖØŌŐŎŒŔŘŖŚŠŞŜȘŤŢŦȚÙÚÛÜŪŮŰŬŨŲŴÝŶŸŹŽŻàá âãäåāąăæçćčĉċďđèéêëēęěĕėƒĝğġģĥħìíîïīĩĭįıĳĵķĸłľĺ ļŀñńňņŉŋòóôõöøōőŏœŕřŗśšşŝșťţŧțùúûüūůűŭũųŵýÿŷžżź ÞþßſÐð

### Disclaimer

[](#disclaimer)

Keep in mind that this validation rule is not doing any conversion of the string (no htmlspecialchars, no htmlentities). Be always careful about how to save strings containing accented letters into your database.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

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

Unknown

Total

1

Last Release

1934d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/df16c7a36d1e30403d77644c234527f954ff5d3ae6a8a72f30a3d0f862537642?d=identicon)[Nikolai\_ln](/maintainers/Nikolai_ln)

---

Top Contributors

[![Nikolai-ln](https://avatars.githubusercontent.com/u/48829928?v=4)](https://github.com/Nikolai-ln "Nikolai-ln (11 commits)")

### Embed Badge

![Health badge](/badges/nikolai-char-validator/health.svg)

```
[![Health](https://phpackages.com/badges/nikolai-char-validator/health.svg)](https://phpackages.com/packages/nikolai-char-validator)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)

PHPackages © 2026

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