Code Monkey home page Code Monkey logo

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

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,

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.

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

[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

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?

Clean Arabic Text (quranic marks, esthetic symbols)

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

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

مراجع:

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

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

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

src/data/ar_numbers.json

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

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

Urdu Support

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

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

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.

Bug when I use Hindi numbers

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

It cause "ErrorException Undefined index".
image

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

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

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

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

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.

ثغرة أمنية: 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

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

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

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

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

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

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

  • الخطأ:
    error

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

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

بارك الله فيك

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

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

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

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

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: '٠١٢٣٤٥٦٧٨٩' ==> '۰۱۲۳۴۵۶۷۸۹'

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

تحياتي لك أستاذنا العزيز
وشكراً جزيلاً لك على جهودك التي استفدت كثيراً منها منذ العام 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

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

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

Has the library the ability to normalize Arabic text?

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

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

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?

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]);
        }

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

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.

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

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

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);

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.

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

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

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

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 رمضان"


ar-php for laravel

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

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.