PHPackages                             herroffizier/yii2-translit-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. herroffizier/yii2-translit-validator

ActiveYii2-extension[Validation &amp; Sanitization](/categories/validation)

herroffizier/yii2-translit-validator
====================================

Yii2 validator that transliterates model attribute values.

1.0.0(9y ago)229.7k↑23.6%BSD-3-ClausePHP

Since Mar 29Pushed 9y ago1 watchersCompare

[ Source](https://github.com/herroffizier/yii2-translit-validator)[ Packagist](https://packagist.org/packages/herroffizier/yii2-translit-validator)[ RSS](/packages/herroffizier-yii2-translit-validator/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (8)Versions (3)Used By (0)

Yii2 Attribute Index Validator
==============================

[](#yii2-attribute-index-validator)

[![Build Status](https://camo.githubusercontent.com/2aa435f562b9990aaac7692de4f20dbf854114db1d2a16a1cb52df8a383bcb37/68747470733a2f2f7472617669732d63692e6f72672f686572726f6666697a6965722f796969322d7472616e736c69742d76616c696461746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/herroffizier/yii2-translit-validator) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/187ea0cff990e42baf0afdc855b2945893bad77ddcae6c68899f2658973c8dab/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f686572726f6666697a6965722f796969322d7472616e736c69742d76616c696461746f722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/herroffizier/yii2-translit-validator/?branch=master) [![Code Coverage](https://camo.githubusercontent.com/f5af94e575cf243f120a1ee55a1ae917494d5eb6b87a07bec252e80ed028477e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f686572726f6666697a6965722f796969322d7472616e736c69742d76616c696461746f722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/herroffizier/yii2-translit-validator/?branch=master) [![Code Climate](https://camo.githubusercontent.com/a59b02141eab392c88e5427c30811ff7c65007227670221905779236023a4cf7/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f686572726f6666697a6965722f796969322d7472616e736c69742d76616c696461746f722f6261646765732f6770612e737667)](https://codeclimate.com/github/herroffizier/yii2-translit-validator)

This validator takes value from one attribute and puts transliterated value to another attribute. Also, validator may prepare transliterated string for usage in URL. Transliteration is made by [URLify](https://github.com/jbroadway/urlify).

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

[](#installation)

Install validator with Composer:

```
composer require --prefer-dist "herroffizier/yii2-translit-validator:@stable"

```

Usage
-----

[](#usage)

Add validator to your model's rules array before `required` validator (if any) and set its `sourceAttribute` property to point source attribute which value should be transliterated.

```
use herroffizier\yii2tv\TranslitValidator;

...

public function rules()
{
    return [
        [['attribute'], 'required'],
        [
            ['attribute_translit'],
            TranslitValidator::className(),
            'sourceAttribute' => 'attribute'
        ],
        [['attribute_translit'], 'required'],
    ];
}
```

Validator has a few options to customize its behavior.

- `sourceAttribute` as mentioned above points to source attribute which value should be transliterated. Empty by default and required.
- `lowercase` enforces lower case for transliterated string. Default is `true`.
- `forUrl` replaces all invalid characters with `invalidReplacement` value. Default is `true`.
- `invalidReplacement` is a replacement for invalid characters. Used in conjunction with `forUrl`. Default is `-`.
- `invalidRegexp` is a regular expression which matches all incorrect symbols for URL. Used in conjunction with `forUrl`. Default is `/[^a-z0-9]+/i` which matches all non-alphanumeric symbols.
- `trimInvalid` trims invalid characters at beginning and at end of given string. Used in conjunction with `forUrl`. Default is `false` which means that no characters will be trimmed.

###  Health Score

34

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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

3646d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/820232d3f5de11b08332a98ca93b025ab46d7e3563ddaec2ce6d042828718983?d=identicon)[herroffizier](/maintainers/herroffizier)

---

Top Contributors

[![korotin](https://avatars.githubusercontent.com/u/277992?v=4)](https://github.com/korotin "korotin (9 commits)")

---

Tags

slugvalidatorurlifyyii2extensionyiiyii 2translittransliteration

###  Code Quality

TestsCodeception

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/herroffizier-yii2-translit-validator/health.svg)

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

###  Alternatives

[kdn/yii2-domain-validator

Domain name validator for Yii 2.

11121.4k1](/packages/kdn-yii2-domain-validator)[nepstor/yii2-datetime-compare-validator

Yii2 validator for compare datetime.

1283.2k1](/packages/nepstor-yii2-datetime-compare-validator)

PHPackages © 2026

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