KyawNaingTun / tounicode by kyawnaingtun

"Laravel zawgyi to unicode converter"
977
14
2
Package Data
Maintainer Username: kyawnaingtun
Maintainer Contact: kyawnainghtun93@gmail.com (Kyaw Naing Tun)
Package Create Date: 2016-12-02
Package Last Update: 2024-05-29
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2025-02-06 15:02:26
Package Statistics
Total Downloads: 977
Monthly Downloads: 3
Daily Downloads: 0
Total Stars: 14
Total Watchers: 2
Total Forks: 4
Total Open Issues: 0

ToUnicode (Laravel Easy Converter)

dev-master Download

ဇော်ဂျီဖြင့် ရေးသားထားသော input values များကို unicode(ယူနီကုဒ်) အဖြစ် automatic ပြောင်းလဲပေးမည့် laravel package လေးတစ်ခုပါ။ Zawgyi/Unicode အား auto detect သိဖို့ရန်အတွက် ကူညီပေးသော ကွီးဖြိုးဇော်ထွန်း အား အထူးကျေးဇူးတင်ရှိပါသည်။ :D (မှတ်ချက်။။ converter ၏ unicode font သို့ ပြောင်းလဲမှုသည် ၁၀၀% မမှန်နိုင်ပါ။)

AngularJs (Front-End) အတွက်ဆိုရင်တော့ ဒီမှာ လာယူပါ။

composer နဲ့ဘယ်လိုယူရမလဲ?

composer require kyawnaingtun/tounicode dev-master

Auto Convert on Save

အရင်ဆုံး ယခု converter ကိုအသုံးပြုမည့် Model file ထဲသို့သွားပါ။ အောက်ပါအတိုင်း TounicodeTrait ကို ထည့်ပါ၊ သင်ပြောင်းလဲလိုသော table field name ကို ဒီထဲမှာ protected $convertable=[] ထည့်ပေးပါ။ အထက်ပါလုပ်ဆောင်ချက်အားလုံးပြီးပါက၊ ယခု Post model မှ title နှင့် content သည် user ထည့်လိုက်သည့် data မှန်သမျှ အားလုံးကို unicode auto ပြောင်းပေးသွားမည်ဖြစ်သည်။

# your-model-folder/post.php
namespace App;

use Illuminate\Database\Eloquent\Model;

use Kyawnaingtun\Tounicode\TounicodeTrait;

class Post extends Model
{
    use TounicodeTrait;

    protected $table = 'post';

    protected $fillable = ['title', 'content'];

    /**
     * These are the attributes to convert before saving.
     * To covert automatically from Non-Unicode to Unicode fonts
     * @var array
     */
    protected $convertable = ['title','content'];
    
}

Global Helper functions

သင်ပြောင်းလဲလိုသော value ကို အောက်ပါ function အသုံးပြုပြီး ပြောင်းလဲနိုင်သည်။

tounicode($value);//will convert to unicode value

ဖောင့်အမျိုးအစားသိချင်လျှင် အောက်ပါ function ဖြင့်စစ်နိုင်သည်။

/**
 * return string: uni, zg, mm, eng
 * uni = unicode
 * zg = zawgyi
 * mm = myanmar font
 * eng = english
checkFontType($value);

Conclusion

ဒီ laravel package လေးကို အသုံးပြုပြီးတော့ zawgyi နှင့် unicode ပြဿနာအား တစိတ်တပိုင်းဖြေရှင်းနိုင်လိမ့်မည်ဟု ယုံကြည်ပါတယ်။

Credits

Ko Phyo Zaw Tun (Miracle Digitech) Ko Saturngod (Rabbit) Ko Satkyar (mmfont)