Download the PHP package enaxon/rtly-kit without Composer
On this page you can find all versions of the php package enaxon/rtly-kit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download enaxon/rtly-kit
More information about enaxon/rtly-kit
Files in enaxon/rtly-kit
Package rtly-kit
Short Description Dates, numbers and checks for Persian and Arabic PHP apps: Jalali, Hijri and Hebrew calendars, Iranian validators, number words, holidays and prayer times. No required dependencies.
License MIT
Homepage https://github.com/ehsanenaloo/RTLY-Kit
Informations about the package rtly-kit
Why this exists
Persian and Arabic PHP tools are spread over many packages. One handles Jalali dates. Another checks national codes. A third turns numbers into words. Most of them need Carbon or a whole framework.
RTLY-Kit puts the common pieces in one place. It is plain PHP. You install it, import a function and use it. There is no setup step, and the config file is optional.
Install
The helpers are namespaced functions, so they cannot clash with your own code. If you like short global names, you can turn them on.
What is inside
| Area | What you get |
|---|---|
| Calendars | Jalali, Hijri (Umm al-Qura) and Hebrew. Immutable, comparable with each other, plain PHP |
| Validators | National code, Sheba, bank card, mobile, postal code, vehicle plate. Clear results with stable error codes |
| Numbers | Persian, Arabic and English digits. Separators, ordinals. Number words in Persian and Arabic, with gender, case and vowel marks for Arabic |
| Text | Arabic to Persian letters, ZWNJ cleanup, direction and script detection, Persian slugs |
| Holidays | Official Iranian holiday dates for 1394 and 1396 to 1405, reported dates for 1380 to 1393 and 1395, estimates for other years. Offsets and overrides, weekends and business days |
| Prayer times | Tehran, MWL, ISNA, Egypt, Makkah and Karachi methods, high-latitude rules and manual tuning |
| Carbon and Laravel | Carbon macros, six validation rules, a Jalali facade, an Eloquent cast and an optional config file |
What you can do
Work with three calendars
Jalali, Hijri and Hebrew share one contract, so you can compare dates from different calendars.
All three are plain PHP. You do not need ext-calendar. See the Jalali guide and the compare guide.
Check Iranian data
Each validator gives you a clear result, not just true or false.
Error codes are stable strings, like invalid_format and invalid_checksum. You turn them into your own messages. Validators never throw. Odd input, such as null or an array, gives invalid_type. A mobile result also tells you if the prefix lies in a mobile block of the national numbering plan (allocated).
Write numbers and clean text
Find holidays and prayer times
See Holiday calendar and Prayer times.
Use it with Carbon and Laravel
Carbon macros turn on by themselves when Carbon is installed.
Laravel finds the package on its own. You get six validation rules (mobile is a short alias of iran_mobile) with Persian, English and Arabic messages, a Jalali facade and an Eloquent cast. Publish the optional config file with php artisan vendor:publish --tag=rtly-kit-config.
More in the Laravel guide.
A full guide, in three languages
The guide has 29 pages in English, Persian and Arabic. It has search, a light and a dark theme, and works without JavaScript. Persian and Arabic pages are written right to left.
| English, light theme | Persian, dark theme, right to left |
| Topic | Read |
|---|---|
| Start | Quick start · Installation |
| Calendars | Jalali · Hijri · Hebrew · Convert and compare · Carbon macros |
| Validation | Validators overview · National code · Sheba and bank card · Mobile, postal code, plate |
| Numbers and text | Digits and format · Number words · Arabic number words · Text tools |
| Dates and times | Holidays · Holiday calendar · Prayer times |
| Laravel | Setup · Validation and cast |
| Reference | Helpers · Errors · API stability · Accuracy and data · Limits · Upgrade · Verifying releases · FAQ |
| Other languages | فارسی · العربية |
Helpers without clashes
The 27 helpers live in the RtlyKit namespace. Import what you need with use function. Nothing is added to the global scope.
Want short names like jdate()? Switch them on once, for example in your bootstrap file:
It only adds names that are free. It never replaces your functions and never throws. You can call it twice. The return value lists any names it skipped.
When something goes wrong
Every error the library throws extends RtlyKit\Exceptions\RtlyKitException. Catch that one class and you have them all. Each error has a stable code and some context:
A value of an accepted type that the library cannot use, such as a year outside the supported range, throws a library exception (InvalidDateException for dates). It never leaks a raw TypeError or ValueError. A value of a type the method does not accept, such as an array for a date, is rejected by PHP itself with a TypeError. Read the error guide for the full list.
What we checked
On 2026-10-08 we compared the library with official sources wherever we could reach them.
- Jalali. The conversion gives the same Nowruz dates and leap years as the official table of the University of Tehran for every year from 1206 to 1497. It agrees with the astronomical definition for 1178 to 1502.
- Hijri. Every month start from AH 1318 to 1500 (2196 months) matches the official KACST Umm Al-Qura calendar. AH 1300 to 1317 use ICU/CLDR data.
- Holidays. Official dates for the Jalali years 1394 and 1396 to 1405, checked against two sources, and published dates for 1380 to 1393 and 1395. Other years are estimated from the Hijri calendar. Fixed holidays, like Nowruz, are exact.
- Prayer times. Sunrise and sunset match the NOAA Solar Calculator within a minute. Compared with published tables, the times agree within 1 to 2 minutes for Tehran (Fajr, sunrise, noon, Maghrib), Makkah (all times, including Isha in Ramadan), Egypt (Dar al-Ifta) and Karachi with Hanafi Asr (a Karachi institution, 31 days). The Fajr and Isha of Turkey's Diyanet fit the 18 and 17 degree angles. The Hanafi Asr rule and the ISNA 15 degree angles match statements of Darul Uloom Deoband and the Fiqh Council of North America.
- Data tables. The 19 Sheba bank codes in the Central Bank's published IBAN specification match our table. Every mobile prefix we list lies inside a mobile block of the national numbering plan. Bank BINs and other codes agree with several public pages.
Good to know
- Iran sets religious dates by moon sighting, so an estimated year can be a day or two off. You can correct it with HolidayCalendar.
- We found no timetable issued by ISNA, the Muslim World League or the University of Islamic Sciences in Karachi, and no official Tehran table with Isha and Asr.
- Bank, operator and place names come from public lists, not from an official registry. A valid card can return
nullfor the bank name. - A few Arabic number-word outputs still wait for review by a native speaker.
Found a mistake? Please open an issue with a source. The full list is in the accuracy guide.
Requirements
- PHP 8.2 or newer. That is all it needs. No
mbstringor other extension is required. - No required Composer packages.
nesbot/carbonandilluminate/supportare optional. - Tested in CI on PHP 8.2, 8.3, 8.4 and 8.5. Works with Laravel 11, 12 and 13 (Laravel 13 needs PHP 8.3 or newer) and Carbon 3.
Contributing
Bug reports, data corrections, translation fixes and small pull requests are welcome. Read CONTRIBUTING.md first. It explains the Docker workflow, the code style and how we handle data sources.
- Report a wrong result. Use the data-correction form and add a source. Every table entry needs at least two.
- Improve the words. Fixes for the Persian guide and for Arabic translations are very welcome.
- Star the repository if it saves you time. It helps other people find it.
If RTLY-Kit saves you time, you can buy me a coffee. It is never expected, and it is very much appreciated.
Security problems go through SECURITY.md, not public issues.
Contributors
Thanks to everyone who has helped. Your name appears here after your first merged contribution.
Moving from an early build? See CHANGELOG.md.
License
NOTICE.
About
Made by Ehsan Enaloo. RTLY-Kit is a toolkit for Jalali, Hijri and Hebrew calendars, Iranian validators, number words, holidays and prayer times in PHP.
Topics: jalali hijri hebrew persian arabic rtl php laravel carbon iran prayer-times