PHP code example of stevenay / myanfont
1. Go to this page and download the library: Download stevenay/myanfont 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/ */
stevenay / myanfont example snippets
$autoload = __DIR__.'/vendor/autoload.php';
if (!file_exists($autoload))
{
exit("Need Composer!");
}
��န္မာလိုေျပာမယ္လကြာ'); // Zawgyi
echo MyanFont::fontDetect('မြန်မာလိုပြောမယ်လကွာ'); // Unicode
// Regular Expression Approach
echo MyanFont::fontDetectByRegularExpression('ျမန္မာလိုေျပာမယ္လကြာ'); // Zawgyi
echo MyanFont::fontDetectByRegularExpression('မြန်မာလိုပြောမယ်လကွာ'); // Unicode
// Machine Learning Approach (Deprecated - will remove in next version)
echo MyanFont::fontDetectByMachineLearning('ျမန္မာလိုေျပာမယ္လကြာ'); // Zawgyi
echo MyanFont::fontDetectByMachineLearning('မြန်မာလိုပြောမယ်လကွာ'); // Unicode
echo MyanFont::isMyanmarSar("မြန်မာစာ") ? 'true' : 'false'; // true
echo MyanFont::isMyanmarSar("English") ? 'true' : 'false'; // false
echo MyanFont::uni2zg("ယူနီကုဒ် ကနေ ဇော်ဂျီ");
echo MyanFont::zg2uni("ေဇာ္ဂ်ီ ကေန ယူနီကုဒ္");
composer dump-autoload
if (! function_exists('fontDetect')) {
function fontDetect(string $content, $default = "zawgyi")
{
return SteveNay\MyanFont\MyanFont::fontDetect($content, $default);
}
}
if (! function_exists('isMyanmarSar')) {
function isMyanmarSar(string $content)
{
return SteveNay\MyanFont\MyanFont::isMyanmarSar($content);
}
}
if (! function_exists('uni2zg')) {
function uni2zg(string $content)
{
return SteveNay\MyanFont\MyanFont::uni2zg($content);
}
}
if (! function_exists('zg2uni')) {
function zg2uni(string $content)
{
return SteveNay\MyanFont\MyanFont::zg2uni($content);
}
}