PHP code example of michaskruzelka / lacinka

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

    

michaskruzelka / lacinka example snippets


use Michaskruzelka\Lacinka\Converter;

$converter = new Converter();

$text = "
    Лацінка — іміджавая рэч, яна стварае зусім іншае ўражанне ад мовы, нязвыклае, больш еўрапейскае
    — яна злучае нас з блізкімі нам народамі Цэнтральнай і Ўсходняй Еўропы: палякамі, чэхамі, харватамі,
    якім лацінка адкрывае беларускую мову як мову блізкую і зразумелую. Можа і камусь з беларусаў
    яе існаванне можа дадаць цікавасці да беларускай мовы?
";

$convertedText = $converter->convert($text);

$convertedText = $converter->setVersion('geographic')->convert($text);

$text = "
    Łacinka — imidžavaja reč, jana stvaraje zusim inšaje ŭražannie ad movy, niazvykłaje, bolš jeŭrapiejskaje
    — jana złučaje nas z blizkimi nam narodami Centralnaj i Ŭschodniaj Jeŭropy: palakami, čechami, charvatami,
    jakim łacinka adkryvaje biełaruskuju movu jak movu blizkuju i zrazumiełuju. Moža i kamuś z biełarusaŭ
    jaje isnavannie moža dadać cikavasci da biełaruskaj movy?
";

$convertedText = $converter->directToCyrillic()->convert($text);

$converter = (new Converter(false))->initRules([path_to_the_xml_file]);

...
'versions' => [
    'traditional',
    'geographic',
    '[your_version]'
],
...

$converter->setVersion([your_version]);