PHP code example of livevasiliy / transliterate

1. Go to this page and download the library: Download livevasiliy/transliterate library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

livevasiliy / transliterate example snippets


ElForastero\Transliterate\ServiceProvider::class,

'Transliterate' => ElForastero\Transliterate\Facade::class,

use Transliterate;

Transliterate::make('Двадцать тысяч льё под водой');
// "Dvadcat tisyach lyo pod vodoy"

use ElForastero\Transliterate\Transliterator;

$transliterator = new Transliterator(Map::LANG_RU, Map::GOST_7_79_2000);
$transliterator->make('Двадцать тысяч льё под водой');
// "Dvadcat` ty'syach l`yo pod vodoj"

Transliterate::slugify('Съешь еще этих мягких французских булок, да выпей чаю!');
// sesh-eshhe-etih-myagkih-francuzskih-bulok-da-vipey-chayu

// /resources/maps/ua/ukraine.php

return [
    'ї' => 'i',
    'і' => 'i',
    'є' => 'ie',
];

'ua' => [
    'ukraine' => dirname(__DIR__) . '/resources/maps/ua/ukraine.php',
]

$transliterator = new Transliterator('ua', 'ukraine');
$transliterator->make('Ваша транслітерація');

ElForastero\Transliterate\Transformer::register(\Closure::fromCallable('trim')),

ElForastero\Transliterate\Transformer::register(\Closure::fromCallable('trim')),
ElForastero\Transliterate\Transformer::register(\Closure::fromCallable('strtolower')),

> php artisan vendor:publish --provider="ElForastero\Transliterate\ServiceProvider"
bash
docker-compose up --build

...
php_1  | Runtime:       PHP 8.0.22
php_1  | Configuration: /srv/app/phpunit.xml
php_1  |
php_1  | .....                                                               5 / 5 (100%)
php_1  |
php_1  | Time: 00:00.959, Memory: 14.00 MB
php_1  |
php_1  | OK (5 tests, 6 assertions)