Home

Awesome

Transliterate.php

A PHP class for transliteration

Simple examples:

echo Transliterate::to_ascii('Фёдор Михайлович Достоевский', 'russian');
// Result: Fedor Mihajlovich Dostoevskij

echo '<br />';

echo Transliterate::to_ascii('Фьодор Михайлович Достоевски', 'bulgarian');
// Result: Fyodor Mihaylovich Dostoevski

Example on CodeIgniter framework, making a slug for permalink creation:

$product_name = 'Авторско колие с естествен камък тюркоаз';

$product_name_ascii = Transliterate::to_ascii($product_name);
// Result: Avtorsko kolie s estestven kamak tyurkoaz

$product_slug = url_title($product_name_ascii, '-', true);
echo $product_slug;
// Result: avtorsko-kolie-s-estestven-kamak-tyurkoaz

Author: Ivan Tcholakov ivantcholakov@gmail.com, 2012-2021

License: The MIT License