PHPackages                             zvermafia/transliteration - 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. [API Development](/categories/api)
4. /
5. zvermafia/transliteration

ActiveLibrary[API Development](/categories/api)

zvermafia/transliteration
=========================

Uzbek latin &lt;=&gt; cyrillic transliterator

v0.1.0(6y ago)0241MITPHPPHP &gt;=7.1.3CI failing

Since Feb 17Pushed 6y ago1 watchersCompare

[ Source](https://github.com/zvermafia/transliteration)[ Packagist](https://packagist.org/packages/zvermafia/transliteration)[ Docs](https://github.com/zvermafia/transliterator)[ RSS](/packages/zvermafia-transliteration/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (2)Used By (1)

Uzbek transliterator
====================

[](#uzbek-transliterator)

[![Latest Version on Packagist](https://camo.githubusercontent.com/29c26bb25cf6f658fb2d5221ef403ee43bf2bbb4603a335cba9d36028c89ab0e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a7665726d616669612f7472616e736c697465726174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/zvermafia/transliteration)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/a218a3e431d5d77ad1e7d9cd8df972a8c3ff747448201c61a22e4ed6784d5bbe/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7a7665726d616669612f7472616e736c697465726174696f6e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/zvermafia/transliteration)[![Coverage Status](https://camo.githubusercontent.com/a83653b175163e1c49324c483aa663d3dea7b3ea6cdda1a31133e947358df362/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f7a7665726d616669612f7472616e736c697465726174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/zvermafia/transliteration/code-structure)[![Quality Score](https://camo.githubusercontent.com/8b2bb9e08d920997827daa272fcf3a2e8f9591cb51ded5ca0577ceec08f3f3bc/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7a7665726d616669612f7472616e736c697465726174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/zvermafia/transliteration)[![Total Downloads](https://camo.githubusercontent.com/9f2ce15c4c4f9bca0511ba6c9e3b760e8fa0511d171d762e9d1a79cbd785a967/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a7665726d616669612f7472616e736c697465726174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/zvermafia/transliteration)

Uzbek latin &lt;=&gt; cyrillic transliterator. Under the hood it uses some online transliteration services. But it's extendable!

### Navigation by sections

[](#navigation-by-sections)

- [Install](#install)
- [Usage](#usage)
- [Make your own implementation (extending)](#make-your-own-implementation-extending)
- [Change log](#change-log)
- [Testing](#testing)
- [Contributing](#contributing)
- [Security](#security)
- [Credits](#credits)
- [License](#license)

Install
-------

[](#install)

Via Composer

```
$ composer require zvermafia/uzbek-transliterator
```

Usage
-----

[](#usage)

Out of the box there are two implementations for your choice:

1. `Zvermafia\Transliteration\AlifTransliterator` which uses an [alif.uz](http://alif.uz) online transliteration service's API;
2. `Zvermafia\Transliteration\LotinTransliterator` which uses a [lotin.uz](https://lotin.uz) online transliteration service's API;

Also you can implement your own class which will use another service's API or won't use any services' API and does all the job by itself.

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

// Initialize the object
$transliterator = new Zvermafia\Transliteration\AlifTransliterator(); // or you can use LotinTransliterator

$transliterator->setText("Salom, dunyo!")
    ->toCyrillic()
    ->translit();

echo $transliterator->getResult(); // it will output: Салом, дунё!
```

Make your own implementation (extending)
----------------------------------------

[](#make-your-own-implementation-extending)

If these two already exist implementations aren't enough for you, then you can extend functionalities of this package by implementing your own transliterator class. If so there are three possible ways:

1. Create a class by implementing a `Zvermafia\Transliteration\Interfaces\TransliteratorInterface` interface. In this case you must realize all the methods defined in the interface from scratch by yourself;
2. This is the recommended way (if you're not going to use third party APIs with HTTP). Create a class by extending `Zvermafia\Transliteration\Abstracts\TransliteratorAbstract` abstract class. In this case you must realize only that methods which aren't already realized by the abstract class. The abstract class already realized common methods of the interface;
3. This one is similar to the previous way. Because in this case you'll use a `Zvermafia\Transliteration\Abstracts\HttpTransliteratorAbstract` abstract class which is extends by the `Zvermafia\Transliteration\Abstracts\TransliteratorAbstract`. But what is the difference? The difference is in this abstract class realized some common methods which will work with the HTTP through the cURL extension. So you must only configure some specific HTTP request parameters to work with an API.

So here are examples by the points.

**An example for the point number 1:**

```
