PHPackages                             nurbekjummayev/laravel-cyrillic-latin - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. nurbekjummayev/laravel-cyrillic-latin

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

nurbekjummayev/laravel-cyrillic-latin
=====================================

Uzbek Cyrillic &lt;-&gt; Latin transliteration package for Laravel

1.1(1mo ago)114MITPHPPHP ^8.3CI passing

Since Jun 12Pushed 1mo agoCompare

[ Source](https://github.com/nurbekjummayev/laravel-cyrillic-latin)[ Packagist](https://packagist.org/packages/nurbekjummayev/laravel-cyrillic-latin)[ RSS](/packages/nurbekjummayev-laravel-cyrillic-latin/feed)WikiDiscussions main Synced 1w ago

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

Laravel Cyrillic ⇄ Latin
========================

[](#laravel-cyrillic--latin)

Uzbek Cyrillic ⇄ Latin transliteration package for Laravel.

- Context-aware rules, not blind character mapping:
    - `е → ye` at word start / after vowels (`Етти → Yetti`), `e` elsewhere
    - `ц → s` at word start / after consonants (`акция → aksiya`), `ts` after vowels (`доцент → dotsent`)
    - `e → э` at word start / after vowels (`ekologiya → экология`, `poeziya → поэзия`)
    - `ъ/ь` before `е` is a separator: `объект → obyekt`, `съезд → syezd`, `премьера → premyera`
    - `с + ҳ` is kept apart from the `sh` digraph: `Исҳоқ ⇄ Is’hoq`
    - digraphs `o‘ g‘ ch sh ya yo yu ts` in both directions, including word-final `tog‘ → тоғ`
    - tutuq belgisi: `ma’no ⇄ маъно`, `e’lon ⇄ эълон`
    - abbreviations stay ALL-CAPS: `ЧИРЧИҚ → CHIRCHIQ` (not `ChIRChIQ`)
- Accepts every common apostrophe variant: `‘ ’ ʻ ʼ '`
- **URLs, e-mail addresses, HTML tags and entities are never touched**
- Built-in exception dictionary with 200+ stems that break the rules: `kompyuter → компьютер`, `aksiya → акция`, `rayon → район` (not `раён`), ...
- **Suffix-aware stems**: one entry covers every Uzbek suffix chain — `kompyuterlarida → компьютерларида`, `rollar → роллар` (final `ь` dropped), effectively tens of thousands of word forms
- Word-level dictionary for your own exception words, with automatic case preservation
- Facade, `Str` macros, and a framework-free core

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

[](#requirements)

- PHP 8.3+
- Laravel 12 or 13

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

[](#installation)

```
composer require nurbekjummayev/laravel-cyrillic-latin
```

The service provider is auto-discovered.

Publish the config (optional, for custom dictionaries):

```
php artisan vendor:publish --tag=laravel-cyrillic-latin-config
```

Usage
-----

[](#usage)

### Facade

[](#facade)

```
use NurbekJummayev\LaravelCyrillicLatin\Facades\Transliterator;

Transliterator::toLatin('Ассалому алайкум, Ўзбекистон!');
// "Assalomu alaykum, O‘zbekiston!"

Transliterator::toCyrillic("O'zbekiston — buyuk davlat");
// "Ўзбекистон — буюк давлат"

Transliterator::convert('Салом', 'latin');   // "Salom"
Transliterator::swap('Salom');               // "Салом" (auto-detects the script)
Transliterator::hasCyrillic('Салом');        // true
```

> Note: always import the facade with `use`. The package intentionally does not register a global `Transliterator` alias because PHP's `intl` extension already defines a global `\Transliterator` class.

### Str macros

[](#str-macros)

```
use Illuminate\Support\Str;

Str::toLatin('Тошкент шаҳри');   // "Toshkent shahri"
Str::toCyrillic('Samarqand');    // "Самарқанд"
```

### Dependency injection

[](#dependency-injection)

```
use NurbekJummayev\LaravelCyrillicLatin\Transliterator;

public function show(Transliterator $transliterator)
{
    return $transliterator->toLatin($post->title_cyrillic);
}
```

### Without Laravel

[](#without-laravel)

The core has no framework dependencies:

```
use NurbekJummayev\LaravelCyrillicLatin\Transliterator;

$transliterator = new Transliterator();
$transliterator->toLatin('Фарғона');     // "Farg‘ona"
$transliterator->toCyrillic('Chirchiq'); // "Чирчиқ"
```

### HTML and URLs

[](#html-and-urls)

Markup, links and e-mails are preserved as-is:

```
Transliterator::toCyrillic('Toshkent haqida: https://example.uz yoki info@misol.uz');
// 'Тошкент ҳақида: https://example.uz ёки info@misol.uz'
```

Dictionary (exception words)
----------------------------

[](#dictionary-exception-words)

### Built-in exceptions

[](#built-in-exceptions)

The Cyrillic soft/hard signs (`ь`/`ъ`) and the letter `ц` are not written in Latin script, so the Cyrillic spelling of many loanwords cannot be reconstructed by letter rules (`kompyuter` would become `компютер`, `aksiya`would become `аксия`). The package ships a curated list of 200+ stems — months, `ц`-words and common loanwords — in [resources/dictionaries](resources/dictionaries) (plain PHP arrays, cached by opcache):

```
Transliterator::toCyrillic('kompyuter'); // "компьютер" (not "компютер")
Transliterator::toCyrillic('aksiya');    // "акция"     (not "аксия")
Transliterator::toCyrillic('konsert');   // "концерт"   (not "консерт")
Transliterator::toCyrillic('rayon');     // "район"     (not "раён")
Transliterator::toCyrillic('mer');       // "мэр"       (not "мер")
```

Every stem is **suffix-aware** — the engine recognizes Uzbek suffix chains (`lar`, `i`, `ning`, `da`, `gacha`, ...) and converts them by the letter rules while taking the stem from the dictionary. A word-final `ь` is dropped before a suffix, as Uzbek Cyrillic orthography requires:

```
Transliterator::toCyrillic('kompyuterlarida'); // "компьютерларида"
Transliterator::toCyrillic('aksiyalarga');     // "акцияларга"
Transliterator::toCyrillic('rollar');          // "роллар" (роль + лар)
```

Lookalike words are protected: a stem only matches when the remainder is a valid suffix chain, so `rolik → ролик` (not роль + ik) and `seriya → серия` (not сэр + iya).

Disable the built-ins with `'use_default_dictionary' => false` in the config.

Abbreviations need no special handling — the letter rules already produce the correct result and dots are left untouched:

```
Transliterator::toLatin('12 янв. 2026'); // "12 yanv. 2026"
```

### Your own exceptions

[](#your-own-exceptions)

Define them in `config/cyrillic-latin.php` (keys are matched case-insensitively; the original word's capitalization is restored automatically). Your entries always override the built-ins:

```
'dictionaries' => [
    'latin' => [
        'цех' => 'sex',
    ],
    'cyrillic' => [
        'sex' => 'цех',
    ],
],
```

```
Transliterator::toLatin('Цех');  // "Sex"
Transliterator::toLatin('ЦЕХ');  // "SEX"
```

Architecture
------------

[](#architecture)

```
src/
├── Transliterator.php                ← public API: toLatin, toCyrillic, convert, swap
├── CyrillicLatinServiceProvider.php  ← spatie/laravel-package-tools provider
├── Facades/Transliterator.php
├── Contracts/
│   └── Converter.php                 ← convert(string $text): string
├── Support/
│   ├── Alphabet.php                  ← single source of truth for letter mappings
│   └── Dictionary.php                ← exception-word lookup with case preservation
└── Converters/
    ├── ScriptConverter.php           ← word walker; skips HTML/URLs/e-mails
    ├── CyrillicToLatinConverter.php
    └── LatinToCyrillicConverter.php

```

Both directions are derived from one lowercase letter table in `Support/Alphabet.php` — uppercase forms, ALL-CAPS digraphs and apostrophe variants are generated from it, so the two directions can never drift apart.

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

MIT

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance91

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

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 ~3 days

Total

2

Last Release

42d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/82907151?v=4)[Nurbek](/maintainers/nurbekJummayev)[@nurbekjummayev](https://github.com/nurbekjummayev)

---

Top Contributors

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

---

Tags

laraveltranslitlatintransliterationcyrillicuzbek

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nurbekjummayev-laravel-cyrillic-latin/health.svg)

```
[![Health](https://phpackages.com/badges/nurbekjummayev-laravel-cyrillic-latin/health.svg)](https://phpackages.com/packages/nurbekjummayev-laravel-cyrillic-latin)
```

###  Alternatives

[nativephp/mobile

NativePHP for Mobile

1.1k75.1k110](/packages/nativephp-mobile)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

45955.7k](/packages/harris21-laravel-fuse)

PHPackages © 2026

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