PHP code example of turanjanin / serbian-language-tools
1. Go to this page and download the library: Download turanjanin/serbian-language-tools 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/ */
turanjanin / serbian-language-tools example snippets
use Turanjanin\SerbianLanguageTools\Text;
$text = Text::fromString('Zdravo svete, ovo je primer teksta!');
use Turanjanin\SerbianLanguageTools\Text;
use Turanjanin\SerbianLanguageTools\Transformers\DiacriticRestorer;
$text = Text::fromString('Cetiri cavke cuceci dzangrizavo cijucu u zeleznickoj skoli.');
echo (new DiacriticRestorer)($text); // Četiri čavke čučeći džangrizavo cijuču u železničkoj školi.
use Turanjanin\SerbianLanguageTools\Text;
use Turanjanin\SerbianLanguageTools\Transformers\ToAsciiLatin;
use Turanjanin\SerbianLanguageTools\Transformers\ToCyrillic;
use Turanjanin\SerbianLanguageTools\Transformers\ToLatin;
$cyrillic = Text::fromString('Ово је ћирилични текст');
$latin = Text::fromString('Primer latiničnog teksta');
echo (new ToLatin)($cyrillic); // Ovo je ćirilični tekst
echo (new ToCyrillic)($latin); // Пример латиничног текста
echo (new ToAsciiLatin)($cyrillic); // Ovo je cirilicni tekst
use Turanjanin\SerbianLanguageTools\Text;
Text::fromString('Ovo je latinica')->isLatin(); // true
Text::fromString('Ovo je latinica')->isCyrillic(); // false
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.