PHP code example of victord11 / transliterate

1. Go to this page and download the library: Download victord11/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/ */

    

victord11 / transliterate example snippets


VictoRD11\Transliterate\ServiceProvider::class,

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

use Transliterate;

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

use VictoRD11\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/uk/ukraine.php

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

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

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

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

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

> php artisan vendor:publish --provider="VictoRD11\Transliterate\ServiceProvider"