PHP code example of kyawnaingtun / tounicode

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

    

kyawnaingtun / tounicode example snippets


# 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 $tounicode = ['title','content'];

}

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

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