Giter VIP home page Giter VIP logo

ar-php's Introduction

Contributor Covenant

Ar-PHP Project (ar-php.org)

PHP Speaks Arabic - Be Ready!

Copyright © 2006-2023 Khaled Al-Sham'aa.

DOI

العربية

Mission & Vision

As has happened in the Far East and Latin America, as the Internet goes to the masses, people want it in their native language.

Our mission is to develop open source solutions and provides professional support helps small and medium size companies meet the challenges of developing professional Arabic websites in the PHP/MySQL environment, the library that we develop helps our partners in save time and increase productivity.

This project provides a set of tools that enable Arabic website developers to serve professional search, present and process Arabic content in PHP.

Easy Installation

List of Main Functionalities

Change Log

Class Documentation

Migrating from Version 4.0

Contributors Logistics

How to Contribute?

Professional Support

Citation

If you would cite it in academic work, you can use this citation

K. Al-Shamaa, Ar-PHP, PHP library for website developers to process Arabic content, 
https://github.com/khaled-alshamaa/ar-php, 2023

or in bibtex format

@misc{ar-php,
  title={Ar-PHP, PHP library for website developers to process Arabic content},
  author={Al-Shamaa, Khaled},
  url={https://github.com/khaled-alshamaa/ar-php},
  version = {6.3.4},
  year={2023}
}

Where it has been used?

  • Akeneo: The easy and flexible open source SaaS PIM to organize and enrich your product catalog. [check it out here]

  • Bagisto: Laravel package for e-commerce. [check it out here]

  • LimeSurvey: Open-source survey software. [check it out here and here]

  • ArabKey: Easy way to switch between Arabic and English keyboard, and more useful tools for Arabic language [check it out here].

Arabic Language

Worldwide Internet use has grown tremendously in recent years, most rapidly in non-English speaking regions especially in Arab world. For example, from 2000 to 2020, the online populations grew by more than 9,300 %. Meanwhile, Arabic Web content was estimated to be doubling every year. Such growth has created demand for better websites developing resources in Arabic language. However, existing websites developing resources may be unable to meet it because they primarily serve English-speaking users.

[Arabic language, Internet world stats]

PHP

PHP is a widely-used general-purpose scripting language that is especially suited for web development and can be embedded into HTML. PHP runs more than 79% of all the top 10 million worldwide web sites a few very good examples are Facebook and Wikipedia.

[PHP language, Server-side languages report]

LGPL

The main difference between the GPL and the LGPL is that the latter can be linked to (in the case of a library, 'used by') a non-(L)GPLed program, which may be free software or proprietary software. This non-(L)GPLed program can then be distributed under any chosen terms if it is not a derivative work.

[LGPL, GNU FAQ]

History

محاضرة افتتاحية عن تجربة بناء ادوات لدعم اللغة العربية و المشاريع مفتوحة المصدر - خالد الشمعة

Top

Quick Start

Install with Composer

To install with Composer, simply require the latest version of this package.

composer require khaled.alshamaa/ar-php

Make sure that the autoload file from Composer is loaded. if you are using composer for autoloading like what Laravel framework does, you don't have to do that.

// somewhere early in your project's loading, require the Composer autoloader
// see: http://getcomposer.org/doc/00-intro.md
require 'vendor/autoload.php';

Download and Install (Manually)

Download the latest release of Ar-PHP library and extract it into the directory where it will be used.

require_once 'ar-php/src/Arabic.php';

Main Functionalities

Top

How to Contribute?

We always welcome new contributors – especially new programmers. But no matter what your skills and interests are, there is a place where you can participate to improve Ar-PHP project:

  • Programming: Here are some ideas for contribution: Review the To-Dos, add a feature, contribute to a core module, create an extension, and fix a bug.
  • Quality Assurance: Quality Assurance (QA) is one of the most important but understated elements of any software community project. It is also something most people can do. If you want to help fix Ar-PHP bugs, and you are not a programmer, you can still help by joining the QA team.
  • Writing: One of the best ways to contribute to Ar-PHP is to write tutorials, guides, HOWTOs and FAQs. Here are some ideas for contribution: User FAQs, HOW-Tos and Tutorials, User Guide, Development Primer, Blog Posts, and Article for a Magazine.
  • Marketing: You can always help promote the use of Ar-PHP. Here are two ways you can help: Join the marketing events, distribute Ar-PHP, and Ar-PHP brochure.
  • Graphics and Art: Have any art skills? Then you can help us create icons, logos, banners, labels, wallpapers, screen savers, and more! These will be seen every day and used throughout the project and its products.
  • Helping Users: There are two ways you can help other users: Users mailing list, and forums.
  • Celebrate with us! Your task is to take a picture of yourself supporting PHP and Arabic language project. You can go to a famous landmark, your favorite place nearby, or anywhere you think will make for a great photo. We've created some posters for you to use in your pictures. Print out one of these designs or design your own. We want to see you and your location prominently displayed in the picture, so don't let one of them dominate the photo. And we should clearly see your Ar-PHP poster too. Once you have your photos ready to submit, email them to us. Please send your photos in .jpg or .png formats and at least 1200 x 800 pixels in size.

Top

Professional Support

As the developers of Ar-PHP project, we can help your company leverage the maximum power of Ar-PHP to achieve your business goals. We offer professional services that span the full life-cycle of Ar-PHP implementation.

  • Ar-PHP Library Integration: Having trouble getting started with Ar-PHP? We can help.
  • Ar-PHP Upgrades: For smooth upgrade to a newer version of Ar-PHP, let us assist you.
  • Customization and Configuration: If your business requires functionality beyond or different from that of the feature set of Ar-PHP, our team of PHP and Arabic language experts can fully tailor Ar-PHP to meet your specific business needs.
  • Integration Analysis and Implementation: Arabic localization may be just a component of your entire online business operation. We have the knowledge and experience to integrate Ar-PHP with all the arms of your operation.
  • Troubleshooting, Optimization and Performance Tuning: For increased performance and bottleneck resolution let an Ar-PHP expert look under the hood of your Ar-PHP implementation and server environment.
  • Consulting: At any point in the implementation of Ar-PHP you can call upon a Ar-PHP expert to verify that your implementation follows industry best practices.
  • Training: Get comprehensive training for Ar-PHP.

Top

ar-php's People

Contributors

atefbb avatar devansh-webkul avatar jvarn avatar khaled-alshamaa avatar moghwan avatar mohannadnaj avatar muath-ye avatar muotaz avatar saber13812002 avatar saidbakr avatar sakairyota avatar socotoly avatar tarundb avatar watheqalshowaiter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ar-php's Issues

Some letters are not displayed properly

Hi Sir,
your project is helping me a lot. Now I am looking for a solution to a problem. Hope your reply.

My code:

 $arabicname=' محمد سعید  ';
$name_ar=$Arabic->utf8Glyphs($arabicname);
imagettftext($image,50,0,2260,1390,$color,$fontar,$name_ar);

Output:

7

Unusual margin after using ar-php with Dompdf

Hello Mr @khaled-alshamaa

I am using DomPdf (especially the Laravel version).

before using ArPHP the Arabic letters are separated:

b713d22f-3dfc-4588-8cf6-665230f0805d

After using the library the letters are fine but there is this initial margin:
7acfab0c-8a32-4a8c-8013-391a5d4dbe1e

the code I am using from the library is:

if ( ! class_exists( 'I18N_Arabic' ) ){
            $Arabic = new Arabic();
            $text = $Arabic->utf8Glyphs($text);
        }
}

If there any detail you want, tell me to provide it..

Thanks

ثغرة أمنية: Reflected XSS في ملف الأمثلة القبلة

مرحباً المهندس خالد،
@khaled-alshamaa
يوجد ثغرة أمنية XSS الإنعكاسية (Reflected XSS) خطيرة في ملف الأمثلة قبلة.

لم يتم عملية التحقق من المدخلات المتغير:
$_GET['d'];

xss_exploit

طريقة الإستغلال:
http://localhost/khaled.alshamaa/ar-php/examples/qibla.php?d=5,216,272)%22%3E%3Cscript%20type=%22text/javascript%22%3E%20alert(%27test%20xss%27);%20%3C/script%3E%3C!--

تكمن الخطورة كمثال في قراءة محتويات ملف تعريف الارتباط الكوكيز.
test_xss

Security issue: Reflected XSS in example files

There is a XSS in the example files. The $_GET['keyword'] is not sanitized :

echo $_GET['keyword'];

Proof of Concept

We can read cookie contents : http://localhost/xxx/vendor/khaled.alshamaa/ar-php/examples/ar_query.php?keyword=%3Cscript%3Ealert(document.cookie)%3C/script%3E&submit=%D8%A8%D8%AD%D8%AB+%28Go%29&mode=0

Output:

csrftoken=Aj9xpc4O3p8Se553QLJNlhsFTUgJ3cCp; mode=light

Impact

With XSS, the attacker can read cookies and send requests ...

The example files are part of the composer package, so the likelyhood that these are distributed in applications using your library are very high.

Bug when I use Hindi numbers

When I use the library with Hindi numbers like:
رقم الطالب ٢

It cause "ErrorException Undefined index".
image

some chars are not displaying

hi,
your project is awesome and it help me a lot, but there is a problem I didn't know if it's a bug or a mistake from me,
there are some chars that don't display in the output and the direction is always from left to right take a look

my code :

public function generatePoster(Request $request,Arabic $obj) {
        $title = $request->get('title');
        $title =$obj->utf8Glyphs($title,20,false,true);
        $imgPath = public_path('storage/ichecktemplate.jpg');
        $image = imagecreatefromjpeg($imgPath);
        $color = imagecolorallocate($image, 255, 255, 255);
        $fontSize = 30 ;
        $font = public_path('Almarai-Bold.ttf')
        $x = 640;
        $y = 364;
        imagettftext($image, $fontSize, 0, $x, $y, $color, $font, $title);
        imagejpeg($image, 'save.jpg', 100);
        }

my input: ابتثجحدحدذر زسشصض طعغفقك لمنهو يءأإآةؤ ئى
output:
image

Text becoms upside down when using Arabic->utf8Glyphs

This code snippet tells it all, the first part of this string become last part which make a sentence no readable. also it's adding \n at the end of each line which not exist at the original string, i have fixed this $max parameter to 300.

if you notice 'السلام ' was the in the bingeing at the string but after using utf8Glyphs it become the last one.

use ArPHP\I18N\Arabic;


$arabic = new Arabic();
$str = "السلام عليكم في البداية نقولها وهذا نص رقم ١ و بعده نصين رقم ٢ و بعده نصات ٣ وبالنهاية لا نقول الا الحمدلله  حمدا كثيرا";

echo($arabic->utf8Glyphs($str,300));
/*
ﺍﺮﻴﺜﻛ ﺍﺪﻤﺣ  ﻪﻠﻟﺪﻤﺤﻟﺍ ﻻﺍ ﻝﻮﻘﻧ ﻻ ﺔﻳﺎﻬﻨﻟﺎﺑﻭ ٣   ﺕﺎﺼﻧ ﻩﺪﻌﺑ ﻭ ٢   ﻢﻗﺭ ﻦﻴﺼﻧ ﻩﺪﻌﺑ ﻭ ١   ﻢﻗﺭ ﺺﻧ ﺍﺬﻫﻭ ﺎﻬﻟﻮﻘﻧ ﺔﻳﺍﺪﺒﻟﺍ ﻲﻓ ﻢﻜﻴﻠﻋ ﻡﻼﺴﻟﺍ
*/

is there a way to fix the Glyphs without changing the order of the string?

مشكلة في طباعة الأحرف العربية المنفصلة على الصور في بعض الخطوط

تحياتي لك أستاذنا العزيز
وشكراً جزيلاً لك على جهودك التي استفدت كثيراً منها منذ العام 2009 وحتى اللحظة

ما قمت به:
المطلوب مني طباعة نصوص عربية على صور باستخدام خطوط متعددة, استخدمت لذلك مكتبة Intervention عبر GD و ImageMagick,
بالإضافة قمت باستخدام مكتبتكم وبالتحديد دالة utf8Glyphs
وما يحدث هو أنه عند اختيار بعض انواع الخطوط مثل Vazirmatn أو Amiri وغيرها .. تظهر النصوص بشكل ممتاز جداً كما يجب.
لكن عند اختيار انواع اخرى من الخطوط مثل Tajawal أو Cairo وغيرها ايضاً, فتظهر الأحرف المتصلة بشكل ممتاز ولكن تظهر الاحرف المنفصلة على شكل اشارات غريبة او اشارات استفهام.
علماً أن جميع النصوص مرمزة باستخدام utf-8 (نفس المشكلة في ترميزات اخرى مثل windows-1256)
ونفس الامر عندما forcertl يكون true او false.
ورقم الاصدار
"khaled.alshamaa/ar-php": "^6.2",
الكود:

use ArPHP\I18N\Arabic;   
.   
.   
.   
    $text = "فراس درويش";
    $ar = new Arabic();
    $ar->utf8Glyphs($text)

مثال خط Tajawal (عبر ImageMagick):
disc

مثال خط Tajawal (عبر GD):
disc-gd

مثال خط Amiri (عبر ImageMagick أوGD):
con

New features: normalizing digits

Normalizing different digit styles as
توحيد الأرقام وتنميطها إلى شكل معين

Arabic western numeral: '0123456789'

Arabic eastern digit: '٠١٢٣٤٥٦٧٨٩'

Arabic eastern digit variant: '۰۱۲۳۴۵۶۷۸۹'
الوظائف functions

Normalize digits to Arabic western تنميط الأرقام للتنويعة العربية المغربية
    Arabic eastern digit: '٠١٢٣٤٥٦٧٨٩' ==> '0123456789'
    Arabic eastern digit variant: '۰۱۲۳۴۵۶۷۸۹' ==> '0123456789'

Normalize digits to Arabic eastern تنميط الأرقام للتنويعة العربية المشرقية
    Arabic western numeral: '0123456789' ==> '٠١٢٣٤٥٦٧٨٩'
    Arabic eastern digit variant: '۰۱۲۳۴۵۶۷۸۹' ==> '٠١٢٣٤٥٦٧٨٩'

Normalize digits to Arabic eastern variant: تنميط الأرقام للتنويعة العربية المشرقية المستعملة في شبه القارة الهندية وإيران
    Arabic western numeral: '0123456789' ==> '۰۱۲۳۴۵۶۷۸۹'
    Arabic eastern digit: '٠١٢٣٤٥٦٧٨٩' ==> '۰۱۲۳۴۵۶۷۸۹'

Bug when I use TANWEEN

When I use the library with words has TANWEEN like:
درساً
جيد جداً
It cause "ErrorException Undefined index".
image

Could you please fix it?

Thanks.

ar-php for laravel

Hi, do you have this project for laravel , can you provide an example for laravel project ?

Has the library the ability to normalize Arabic text?

هل مكتبة "PHP واللغة العربية" لديها إمكانية تنميط النصوص العربية Text Normalization ؟ إذا لم تكن فهذا فكرة جميلة لإضافتها للمكتبة..

تذكير العدد وتأنيثه

الله يعطيكم العافية

في الملف التالي:

src/data/ar_numbers.json

ضمن:
individual > male
و
individual > female
الأعداد من 3 إلى 19 عكس القاعدة
فعندما يكون المعدود مذكراً تكون هذه الأعداد مؤنثة والعكس بالعكس.

والأمر الآخر هو أن الهمزة في العدد 2 دائماً همزة وصل؛ هكذا مثلاً:
اثنان / اثنا عشر... إلخ

[bug] Undefined behavior when the correction value causes the gregorian day to be <=0 or >31

ar-php/src/Arabic.php

Lines 1143 to 1149 in 58046cd

if ($hj_d <= 0) {
$hj_d = $hj_d == 0 ? 30 : 29;
list($hj_y, $hj_m, $temp) = $this->arDateGregToIslamic((int)$y, (int)$m, (int)$d + $correction);
} elseif ($hj_d > 30) {
$hj_d = $hj_d == 31 ? 1 : 2;
list($hj_y, $hj_m, $temp) = $this->arDateGregToIslamic((int)$y, (int)$m, (int)$d + $correction);
}

In lines 1145 and 1148, specifically, the $d + $correction portion. If the gregorian day is 1 and the $correction value is -1 or the day is 31 and the $correction value is 1, this causes the day to be an invalid value 0 and 32 respectively. In this case the gregoriantojd() function will return 0 as the passed day is invalid

Texts are not showing properly

I have Arabic text(html file) coming dynamically inside pdf using DomPdf and ar-php library.

I am just showing a line below in the $html variable but the text are not properly displaying, means they are not sorted altogether.

require_once 'ar-php/src/Arabic.php';
$Arabic = new ArPHP\I18N\Arabic();

$html = "يقول الله عز وجل :(وكلوا واشربوا ولا تسرفوا إنه لا يحب المسرفين) الأعراف";

$p = $Arabic->arIdentify($html);

for ($i = count($p)-1; $i >= 0; $i-=2) {
    $utf8ar = $Arabic->utf8Glyphs(substr($html, $p[$i-1], $p[$i] - $p[$i-1]));
    $html   = substr_replace($html, $utf8ar, $p[$i-1], $p[$i] - $p[$i-1]);
}

but its coming like لا يحب المسرفين) الأعراف يقول الله عز وجل :(وكلوا واشربوا ولا تسرفوا إنه

Pls any help would be appreciated.

Undefined offset: -1 for some strings

I'm getting Undefined offset: -1 for some strings at ar-php/src/Arabic.php:2268 with no special cases for strings with errors

code sample

        $Arabic = new Arabic();

        $p = $Arabic->arIdentify($html);

        for ($i = count($p) - 1; $i >= 1; $i -= 2) {
            $utf8ar = $Arabic->utf8Glyphs(substr($html, $p[$i - 1], $p[$i] - $p[$i - 1]));
            $html = substr_replace($html, $utf8ar, $p[$i - 1], $p[$i] - $p[$i - 1]);
        }

Not able to transform 'للا' to utf8 format

Hello @khaled-alshamaa ,

Hope you are doing great. Your project is awesome and helping us a lot, but I am facing a problem with "للإ" letter.

Here is the code which I have used to transform html to utf8 format to then provide to dompdf to generate a pdf.

$invoiceHtml = view('invoice', $invoiceData)->render();
$arabic = new Arabic();
$p = $arabic->arIdentify($invoiceHtml);
for ($i = count($p) - 1; $i >= 0; $i -= 2) {
      $utf8ar = $arabic->utf8Glyphs(substr($invoiceHtml, $p[$i - 1], $p[$i] - $p[$i - 1]), 50, false);
      $invoiceHtml = substr_replace($invoiceHtml, $utf8ar, $p[$i - 1], $p[$i] - $p[$i - 1]);
}

The text line having a problem:

شركة مكتب للإستشارات الهندسية

Output after applying the above code:

مكتب لإxFE#&ستشارات الهندسية شركة

By looking into the output, the issue seems to be with the letter "للإ" apprarently , but you can tell better.

I would really appreciate if you can look into it asap as we need to send invoices to our clients and we are stuck with this problem at the moment.

Thanks in advance.

واجهة مشكلة غريبة مع نص طويل

لدي نص تم نسخه من الانترنت للتجربة فقط،

تحديات عديدة تواجه حكومة ولد عبد الرحمن وتقف في طريق تنفيذ تعهدات رئيس الجمهورية التي اعلن عنها في حملته الدعائية الممهدة للانتخابات الرئاسية التي فاز بها قبل شهور من الان ولعل ابرز هذه التحديات تحدي الفساد النابع من سوء استخدام السلطة العامة من اجل مكاسب شخصية كاختلاس المال العام الذي عاد بقوة في المؤسسات العمومية والشركات وتفشي الرشوة في ادارات ومصالح الدولة حيث اصبح من الصعوبة بمكان ان تسحب مستخرجا من عقد ازدياد او بطاقة تعريف او شهادة وفاة من دون ان ترشي الحارس ثم البواب الذي يقف عند باب المكتب ثم المسؤول بطريقة فاضحة وهكذا.

وبعد عرضه في PDF الجملة تبدأ من وسط السطر ويتم تقطيعها
لاحظ الصورة المرفق
Screen Shot 2022-08-17 at 12 56 04
ة

خطأ: ظهور خطأ عند استخدام الأحرف (للإ) في بداية أي كلمة مثل (للإحسان)

مرحباً المهندس خالد،
@khaled-alshamaa

عند استخدام الأحرف التالية (للإ) في بداية أي كلمة يظهر خطأ في الحزمة
أمثلة للجمل:

  • دورة للإحسان

  • للإضافة يجب عليك

  • الخطأ:
    error

  • مسار الملف: vendor\khaled.alshamaa\ar-php\src\Arabic.php

  • موضع الخطأ في الدالة arGlyphsPreConvert
    err_02

بارك الله فيك

consecutive occurrences of stopwords

If we have a text that contains three stop words like ( والتي قد لا )
the word ( قد) wont be removed
so I have to run the arCleanCommon two or more times

Urdu Support

It functions admirably for the Arabic language. Would it be possible to add support for Urdu characters in the next version?

is there any way to manipulate the string

get the word سَنَةٌ to be more generic by removing the last vowel ٌ to become سَنَة so it will match all versions like سَنَةٍ etc

And then make it more generic to get السَنَة including بالسَنَة

or simple after using $Arabic->stripHarakat($content) and then use all diacritics again

Facing issue to search a specific character into database

  $mode="1";
   $Arabic = new Arabic();
   $Arabic->setQueryStrFields('text');
   $Arabic->setQueryMode($mode);
    $keyword = str_replace('\"', '"', $string);
     $strCondition = $Arabic->arQueryWhereCondition($keyword);
     $strOrderBy   = $Arabic->arQueryOrderBy($keyword);
      $result=DB::table('verses')->select(DB::raw('text',$strCondition,$strOrderBy))->limit(10)->get();
        dd(Verse::where('text','Like','ٱللَّهِ')->get());

i am trying to filter records based on a string but unable to find , i am using your package with laravel

does not comply with psr-4 autoloading

composer require khaled.alshamaa/ar-php
_Using version ^5.5 for khaled.alshamaa/ar-php
./composer.json has been updated
Running composer update khaled.alshamaa/ar-php
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals

  • Locking khaled.alshamaa/ar-php (v5.5.1)
    Writing lock file
    Installing dependencies from lock file (including require-dev)
    Package operations: 1 install, 0 updates, 0 removals
  • Downloading khaled.alshamaa/ar-php (v5.5.1)
  • Installing khaled.alshamaa/ar-php (v5.5.1): Extracting archive
    Generating optimized autoload files
    Class ArPHP\I18N\Arabic located in ./vendor/khaled.alshamaa/ar-php/src/arabic.php does not comply with psr-4 autoloading standard. Skipping.
    Class App\AClass\I18N\I18N_Arabic located in ./app/AClass/I18N/Arabic.php does not comply with psr-4 autoloading standard. Skipping.
    Class App\AClass\I18N\ArabicException located in ./app/AClass/I18N/Arabic.php does not comply with psr-4 autoloading standard. Skipping._

# composer dumpautoload
Generating optimized autoload files
**Class ArPHP\I18N\Arabic located in ./vendor/khaled.alshamaa/ar-php/src/arabic.php does not comply with psr-4 autoloading standard. Skipping.
**

  • in addition we could not manage the file path using new Laravel framework

Clean Arabic Text (quranic marks, esthetic symbols)

تنظيف وتنميط النص العربي بحذف العلامات المختلفة مثل :

  • العلامات القرآنية الموجودة في يونيكود
    • مدخل: -يُنَزِّلُ ٱلْمَلَٰٓئِكَةَ بِٱلرُّوحِ مِنْ أَمْرِهِۦ عَلَىٰ مَن يَشَآءُ مِنْ عِبَادِهِۦٓ أَنْ أَنذِرُوٓاْ أَنَّهُۥ لَآ إِلَٰهَ إِلَّآ أَنَا۠ فَٱتَّقُونِ‎
    • مخرج - يُنَزِّلُ الْمَلَائِكَةَ بِالرُّوحِ مِنْ أَمْرِهِ عَلَىٰ مَن يَشَاءُ مِنْ عِبَادِهِ أَنْ أَنذِرُوا أَنَّهُ لَا إِلَٰهَ إِلَّا أَنَا فَاتَّقُونِ
  • علامات الزخرفة
    • مدخل: الہلہغہة الہعہربيہة+ال͠ل͠غ͠ة ال͠ع͠رب͠ي͠ة+الہٰلہٰغة الہٰعربٰٰيٰة+ال̲ل̲غ̲ة ال̲ع̲ر̲ب̲ي̲ة
    • مخرج: اللغة العربية
  • علامات الإيموجي
    • مدخل:
    • مخرج:

مراجع:

مشكلة مع نص الطويل اكتر من سطر واحد

@khaled-alshamaa
سلام عليكم باش مهندس خالد انا عندي مشكله لو في جمله اكتر من سطر الحروف بتدخل في بعض وانا دورت ولقيت حضرتك قايل لشخص كان عنده نفس المشكله انه يحدد اكتر عدد حروف في السطر وانا عملت كده وفعلا المشكله في الجمله دي اتحلت بس في جمله تانيه في نفس الملف ضربت ولما اغير في عدد الحروف بتظبط الجمله التانيه والاولي لا انا الجمل بتكوني dynamic مش ثابته وفي نفس الملف ممكن الجمل مختلف . انا عملت ال maxLineChr ب 30 فظبط الجملة دي

pic1
ولكن حصل مشكله في الجمله دي
pic2
علما بأني الجملتين في نفس الملف
وده نص الكود بتاعي
Code

Implicit conversion from `float` to `int` when using `getPrayTime()` method

Screenshot 2023-09-23 132752

When using $arabic->getPrayTime(), I got this warning.

I think this is because these 3 lines:

$g = $g % 360 + ($g - ceil($g) + 1);

$q = $q % 360 + ($q - ceil($q) + 1);

$L = $L % 360 + ($L - ceil($L) + 1);

As php documentation says "Operands of modulo are converted to int before processing. For floating-point modulo, see fmod()"
Arithmetic Operators

We can use fmod() function
fmod

$g = fmod($g, 360) + ($g - ceil($g) + 1);

$q = fmod($q, 360) + ($q - ceil($q) + 1);

$L = fmod($L, 360) + ($L - ceil($L) + 1);

Issue in rendering some Quran text

In verse 46 Chapter 7, the following is an image generated by the library:
image

But the following is screenshot of the rendered text on the browser:
image

The original text in Arabic:

وَبَيْنَهُمَا حِجَابٌ ۚ وَعَلَى الْأَعْرَافِ رِجَالٌ يَعْرِفُونَ كُلًّا بِسِيمَاهُمْ ۚ وَنَادَوْا أَصْحَابَ الْجَنَّةِ أَنْ سَلَامٌ عَلَيْكُمْ ۚ لَمْ يَدْخُلُوهَا وَهُمْ يَطْمَعُونَ﴿46﴾ 

A UTF-8 encoded text file, created by Kate text editor (Kubuntu Linux) is attached
46.txt

لدي مشكله في البحث في قواعد البيانات

السلام عليكم ورحمة الله وبركاته

لدي مشكله في بحث النتائج لا يبحث بالشبع أو التقريب

SELECT voted,voters.id as voters_id,gad_num,gad_f_chart,full_name,family_name,age,voters.gender as gender,location.name as location_name,Trusted,Proved_by,CONCAT(School.Name, ' - ',Lajna.Name) as job_title,lajna_id FROM votersinner join location on Location_id=location.id inner join Lajna on Lajna.id=voters.lajna_id inner join School on Lajna.sid=School.id where 1=1 and ( REPLACE(voters.full_name, 'ـ', '') REGEXP 'ع(ا|أ|إ|آ)يش(ة|ه)') AND ( REPLACE(voters.full_name, 'ـ', '') REGEXP 'جم(ا|أ|إ|آ)ل') AND ( REPLACE(voters.full_name, 'ـ', '') REGEXP '(ا|أ|إ|آ)حمد') AND ( REPLACE(voters.full_name, 'ـ', '') REGEXP '((ا|أ|إ|آ)ل)?ه(ا|أ|إ|آ)ر(ون)?') ORDER BYvoters.gad_num,full_name

Hijri date correction not behaving consistently when the Hijri month end on 29th

Hijri date will skip 1 day when the correction value is greater than 1 and the Hijri month end on the 29th instead of the 30th.

Here's an example:
I hardcoded the date so the issue can be reproduced easily.
correction = 0

$Arabic = new \ArPHP\I18N\Arabic();
$g_date = strtotime("2022-04-02");
$hijri = $Arabic->date('j F', $g_date, 0);

output: "29 شعبان"


correction = 1

$hijri = $Arabic->date('j F', $g_date, 1);

output: "30 شعبان"


correction = 2

$hijri = $Arabic->date('j F', $g_date, 2);

output: "2 رمضان"


Arabic numerals not showing correctly

Greetings, I'm working with ar-PHP and I have this issue with rendering numbers correctly as it is shown in the picture below
isuue

any solution for disabling the arabic numerals?

Unable to install any version above 6.0.0

If trying to install any version above 6.0.0, Composer throw an error:
Install of khaled.alshamaa/ar-php failed

In Filesystem.php line 284:

  Could not delete [path]/vendor/composer/c2b443c4\khaled-alshamaa-ar-php-1f31229\docs\pwa\pwa.zip:
  This can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed

Screenshot 2022-12-19 224358

I am trying to install it on a Laravel project.

Tried to manually remove the file but it doesn't exist.

Finally, I rolled back to 6.0.0 version which installed successfully.

numbers inveresed in text

i'm having this issue here the numbers in the text are inveresed

the number is supposed to be 0799380260

image

Bug in versions after 6.2.0, if the string starts with double ل

Assalam Alaikum,

First, thank you for your amazing work on this package. I have been using it for a while now and it has been very helpful.

I am writing to report a bug while using utf8Glyphs function. The bug occurs when the function is passed a string that starts with two consecutive ل characters (for example, للاستخدام). In this case, the function will throw an undefined offset: -1 error on Arabic.php at line 2400.

The error occurs because the function is looking for the previous character at index -2. However, since the string starts with two consecutive ل characters, there is no previous character at index -2.

I am not familiar enough with the code to submit a pull request to fix this bug. However, I would be happy to provide more information or help in any way that I can.

image

Thank you,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.