Download the PHP package stevenay/myanfont without Composer

On this page you can find all versions of the php package stevenay/myanfont. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?
stevenay/myanfont
Rate from 1 - 5
Rated 1.00 based on 1 reviews

Informations about the package myanfont

MyanFont

MyanFont is simple php library for Zawgyi/Unicode font detection plus convertion utilities.

Features

As a notice, it cannot get 100% correction in detecting zawgyi or unicode just by checking to the text. But it will be correct like 80% in most cases. For longer text, it is safe enough to assume 95% correct to detect zawgyi/unicode.

Installation

Install using composer:

Usage

Usage for Laravel Projects

In these days, a lot of Php projects are developed with Laravel Framework including me. Therefore, the following is the recommended way to use this library in Laravel projects;

To use in Controllers and any Php classes:

Just import the class and call the static methods from the class like accessing Utility methods.

To use as Global Helper Functions:

There may be the cases that you want to use as clean helper functions (for example., in your blade views).

In this case, I recommend to create helpers.php file in your app folder (folder structure is your preference). For example: app\Helpers\helpers.php

Then add "helpers.php" file to your composer.json file to autoload:

Then run the commend:

Finally in your app/Helpers/helpers.php file, put the following code to call the functions globally.

Then, you can use like

Why this Library

At the time of this library implementation, I've not found proper Php library for zawgyi/unicode font detection. Currently I'm developing Messenger Chatbot where users can also talk with Bot in Burmese. To respond correctly to users, I need to detect the user's input string is whether zawgyi or unicode.

Using regular expression for unicode characters is not easy enough in php. You have to correctly decode them as well as take care of Escaped characters (e.g. \t\r\n\f) when decoding.

I also have a strong desire to write proper documentation for each regular expression conditions. So I decided to build standard open-source php library for this utility.

Implementation

This library source code is primarily referenced from Ko ThuraMyoNyunt Knayi Javascript library. I have to admit that Knayi is awesome.

Machine Learning

For the machine learning version, I've used official Google Myanmar Tools which is also contributed by me.

In this approach, we can detect the encoding correctly even with the short length of text.

Regular Expression for Detection

I found out popular regular expression to detect zawgyi/unicode which is as below,

The above regular expression is used in Ko SaturnGod Tagu browser addons. Accord to this conversation, the origin developer of this regexp is Ko Ravi. Then it is modified by Ko Thant Thet.

On top of that, the regular expression used in Ko ThuraMyoNyunt Knayi Library is also very good but I added some necessary regular expressions from Ko Ravi's code.

Here is the complete RegExps used in this library.

You can find this RegExps in RuleBase.php class.

Converter

Converter functions are actually defer to Rabbit converter library. I've implemented php magic methods as wrapper around Rabbit original functions.

Documentation of Regular Expressions

Unicode

(please read in Unicode font to properly understand these regular expressions for Unicode)

[ဃငဆဇဈဉညဋဌဍဎဏဒဓနဘရဝဟဠအ]်

ျ[က-အ]ါ

ျ[ါ-း]

\u1031[^\u1000-\u1021\u103b\u1040\u106a\u106b\u107e-\u1084\u108f\u1090]

\u103e|\u103f

\u1031$

\u1031[က-အ]\u1032

\u1025\u102f

\u103c\u103d[\u1000-\u1001]

ည်း (\u100a\u103a)

ျင်း

င် (\u1004\u103a)

န်း (\u1014\u103a)

ျာ

င့်

Zawgyi

'u102c\u1039'

'\u103a\u102c'

whitespace + '(\u103b|\u1031|[\u107e-\u1084])[\u1000-\u1021]

^(\u103b|\u1031|[\u107e-\u1084])[\u1000-\u1021]

[\u1000-\u1021]\u1039[^\u1000-\u1021]

\u1025\u1039

\u1039\u1038

\u1036\u102f

[\u1000-\u1021]\u1039\u1031

\u1064

'\u1039'+whitespace

\u102c\u1031

[\u102b-\u1030\u103a\u1038]\u1031[\u1000-\u1021]

'\u1031\u1031'

'\u102f\u102d'

'\u1039$'

Todo

Credit

License

MIT


All versions of myanfont with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
googlei18n/myanmar-tools Version >=0.1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package stevenay/myanfont contains the following files

Loading the files please wait ....