Skip to content

Russian-English Yandex transliteration package primarily for making slugs

License

Notifications You must be signed in to change notification settings

denismitr/translit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yandex-standard russian-english transliteration

Version

3.0 requires PHP >= 7.2

Author

Denis Mitrofanov [email protected]

Installation

composer require denismitr/translit

Usage

    $translit = new \Denismitr\Translit\Translit();

    $slug = $translit->transform("Строка для транслитерации, по правилам Яндекс!");
    //stroka-dlya-transliteracii-po-pravilam-yandeksa

To define max length of the output do:

$slug = (new \Denismitr\Translit\Translit)->transform("очень длинный текст...", 10);
// ochen-dlin

You can provide your own translit implementation as long as it implements the \Denismitr\Translit\TranslitStrategy interface and inject it into the Translit class constructor, this way it will override the default behavior like so:

new \Denismitr\Translit\Translit(new YourTranslitStrategyImpl());

Run tests

composer test

About

Russian-English Yandex transliteration package primarily for making slugs

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages