muaid / arphp
Yii extension to intigrate the great library ar-PHP in Yii, ar-PHP is a great library to support Arabic in PHP Developed by Khaled Al-Sham'aa
Requires
- yiisoft/yii: dev-master
This package is auto-updated.
Last update: 2024-04-29 03:15:50 UTC
README
بسم الله الرحمن الرحيم
ar-php extension is a wrapper extension to the great library Ar-PHP which is developed by Khaled Al-Sham'aa
Note: using the library directly as a vendor without using an extension is better but the problem is that we should modify a file in the library to make it work and i preferred not to touch the lib files. (maybe i will make a wiki to explain how)
Library Features
- Arabic text auto summarization
- Advanced Arabic search (stem based)
- Render Arabic text (PDF, GD, SWF)
- Present dates in Arabic or Hijri
- Convert Hijri date into Unix timestamp
- Parse Arabic textual datetime into timestamp
- Transliterate English words in Arabic
- Transliterate Arabic words in English
- Spell numbers in Arabic idiom
- Phonetically alike Arabic words
- Arabic character set converter
- Arabic character set auto detection
- Identify Arabic in multi language documents
- Identify names & places in Arabic text
- Guess gender of Arabic names
- Convert keyboard language programmatically
- Calculate the time of Muslim prayer
- Compress string using Huffman-like coding
- Standardize Arabic text
- Arabic stemmer
- Arabic Cities List
- Informations about Arabic countries
- Arabic text normalisation
##Requirements
This extension developed using Yii version 1.1.14 RC but it should work in all Yii versions.
##Installation
-
download and extract the extension into extensions folder: protected/extensions/ar-php
-
download the library from here.
-
extract the library into Your-Application-Folder/vendor , example:
[php]
webroot/my-yii-project-folder/protected/vendor/I18N
- configure the component by updating config/main.php as follow:
[php]
'import'=>array(
...
'ext.ar-php.*'
...
),
'components'=>array(
...
'I18N_Arabic'=>array(
'class'=>'EArPHP',
'libPath'=>'application.vendor.I18N' // optional since it is the default value
),
...
),
##Usage
I tried to make the usage of the extension as easy as i can, in the official website there is an example of usage and it will not work for our extension but it will help us to compare between them, which is:
[php]
include('I18N/Arabic.php');
$obj = new I18N_Arabic('Numbers');
echo $obj->int2str(1975); // ألف و تسعمئة و خمس و سبعون
to generate the same example using ar-php extension use:
[php]
$obj = Yii::app()->I18N_Arabic->Numbers;
echo $obj->int2str(1975); // ألف و تسعمئة و خمس و سبعون
or simply:
[php]
echo Yii::app()->I18N_Arabic->Numbers->int2str(1975); // ألف و تسعمئة و خمس و سبعون
the same concept apply for all other features, and you can follow any feature link above for documentation and usage example.
##Resources