PHPackages                             ashtokalo/php-translit - 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. ashtokalo/php-translit

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

ashtokalo/php-translit
======================

PHP library to convert text from one script to another.

0.3.0(2y ago)40146.2k—6.8%18[2 issues](https://github.com/ashtokalo/php-translit/issues)1MITPHPPHP &gt;=7.0

Since Sep 26Pushed 2y ago2 watchersCompare

[ Source](https://github.com/ashtokalo/php-translit)[ Packagist](https://packagist.org/packages/ashtokalo/php-translit)[ RSS](/packages/ashtokalo-php-translit/feed)WikiDiscussions master Synced 1mo ago

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

translit
========

[](#translit)

`translit` is a PHP library to convert text from one script to another. Currently it assume conversion of Cyrillic, Georgian, Armenian and Greek scripts into Roman (Latin). Cyrillic has sub-groups for Russian, Ukrainian, Belarusian, Bulgarian and Kazakh languages with custom rules.

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

[](#installation)

This package can be installed through Composer:

```
$ composer require ashtokalo/php-translit
```

Make sure to use Composer's autoload:

```
require __DIR__.'/../vendor/autoload.php';
```

Usage
-----

[](#usage)

Main class Translit could be used as singleton or object itself. Built-in transliteration tables could be referred by following language codes:

- ru - Russian cyrillic chars,
- uk - Ukrainian cyrillic chars,
- mk - Macedonian cyrillic chars,
- be - Belarusian cyrillic chars (converted to latin with diacritical),
- bg - Bulgarian cyrillic chars (converted to latin with diacritical),
- kk - Kazakh cyrillic chars (converted to latin with diacritical),
- ka - Georgian chars,
- hy - Armenian chars (converted to latin with diacritical),
- el - Greek chars (converted to latin with diacritical),
- cyrillic - all cyrillic chars according to ISO 9:1995,
- latin - only latin chars without diacritical marks,
- ascii - only ASCII chars, all non ASCII will be replaced with question mark.

Language codes could be combined by comma to handle more cases, e.g.

```
echo \ashtokalo\translit\Translit::object()->convert('Беларусь', 'be') . ' vs ' .
    \ashtokalo\translit\Translit::object()->convert('Беларусь', 'be,latin');
```

produce output:

```
Bielaruś vs Bielarus

```

You can also add alternative transliteration tables through property `classes`, which is list of language code in keys and class names in values:

```
$translit = new \ashtokalo\translit\Translit;
$translit->classes['tlh'] = \startrek\TranslitKlingon::class;
echo $translit->convert(' ', 'tlh');
```

By default wrong language codes ignored. But this behavior could be changed by using strict mode. For all language codes that prepended with exclamation mark exception will be fired if any error (no conversion table, wrong format, empty). For example:

```
// following code returns 'Привет' as is because handler ru_ru not defined
echo Translit::object()->convert('Привет', 'ru_ru') . PHP_EOL;

// but next code fires Exception, because strict mode have used
echo Translit::object()->convert('Привет', '!ru_ru') . PHP_EOL;

```

Tests
-----

[](#tests)

The package contains integration tests. You can run them using PHPUnit.

```
$ vendor/bin/phpunit
```

Credits
-------

[](#credits)

All transliteration tables were created from information found at Wikipedia. The links to these pages posted into header of each file. Please update me if any mistakes found or you have new transliteration tables to add here.

There are many sources of these tables which could be used - ISO and BGN/PCGN standards, a lot of native standards and informal standard used by people. For this library I assume next order of sources - native, ISO, BGN/PCGN, informal.

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

[](#contributing)

Contributions are very welcome.

Only contributions via Pull Requests on [Github](https://github.com/ashtokalo/php-translit) is accepted:

- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)**
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
- **Create feature branches** - Don't ask me to pull from your master branch.
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.

License
-------

[](#license)

The MIT License (MIT). Refer to the [License](LICENSE) for more information.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity46

Moderate usage in the ecosystem

Community20

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 77.4% 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 ~522 days

Total

2

Last Release

808d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b7ef8528d4033226c23e7fe1981413586609b33298fdc1a49ec12e24d1b401c7?d=identicon)[ashtokalo](/maintainers/ashtokalo)

---

Top Contributors

[![ashtokalo](https://avatars.githubusercontent.com/u/1886284?v=4)](https://github.com/ashtokalo "ashtokalo (24 commits)")[![adavesik](https://avatars.githubusercontent.com/u/4726494?v=4)](https://github.com/adavesik "adavesik (2 commits)")[![chr314](https://avatars.githubusercontent.com/u/6598377?v=4)](https://github.com/chr314 "chr314 (2 commits)")[![LukStankovic](https://avatars.githubusercontent.com/u/14925987?v=4)](https://github.com/LukStankovic "LukStankovic (2 commits)")[![markovic131](https://avatars.githubusercontent.com/u/1120908?v=4)](https://github.com/markovic131 "markovic131 (1 commits)")

---

Tags

translittransliterationromanizationlatinization

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ashtokalo-php-translit/health.svg)

```
[![Health](https://phpackages.com/badges/ashtokalo-php-translit/health.svg)](https://phpackages.com/packages/ashtokalo-php-translit)
```

###  Alternatives

[jbroadway/urlify

A fast PHP slug generator and transliteration library that converts non-ascii characters for use in URLs.

6737.4M62](/packages/jbroadway-urlify)[ausi/slug-generator

Slug Generator

8002.2M22](/packages/ausi-slug-generator)[voku/urlify

PHP port of URLify.js from the Django project. Transliterates non-ascii characters for use in URLs.

254.1M7](/packages/voku-urlify)[fresh/transliteration

PHP library for transliteration.

52135.6k1](/packages/fresh-transliteration)[liopic/korean-romanizer

Library to romanize Korean in UTF-8 format

18162.4k](/packages/liopic-korean-romanizer)[sanskrit/sanscript

Transliteration library for Sanskrit and other Indian languages.

162.9k](/packages/sanskrit-sanscript)

PHPackages © 2026

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