Download the PHP package sdo-sa/hijri-converter without Composer

On this page you can find all versions of the php package sdo-sa/hijri-converter. 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?

Informations about the package hijri-converter

hijri-converter

Accurate Hijri (Umm al-Qura) ⇄ Gregorian date conversion for PHP.

Installation

Requires PHP 8.2+.

Quick start

Everything goes through the single static class SDOSA\Hijri — identical in plain PHP or Laravel:

Value objects

Conversions return small immutable value objects — SDOSA\HijriDate and SDOSA\GregorianDate — that carry the rich API below. Build them yourself with ::make() (or a named constructor); the plain new constructor is intentionally closed off, so there is exactly one obvious way to create a date.

API reference

Both value objects share the same shape:

Method Returns Example
year() month() day() int 1403, 2, 17
toIso() string 1403-02-17
format($sep = '/', $pad) string 17/02/1403
monthName($locale = null) string صفر / Safar
dayName($locale = null) string الخميس / Thursday
notation($locale = null) string هـ / AH
longFormat($locale = null) string 17 صفر 1403 هـ / 17 Safar 1403 AH
isoWeekday() int (1–7) 4 — ISO, Monday = 1
weekday() int (1–7) 5 — Saudi week, Sunday = 1
equals($other) bool
compareTo($other) int (-1, 0, 1)
(string) $date string same as toIso()

HijriDate adds monthLength(), yearLength(), and toGregorian(); GregorianDate adds toDateTime(), toCarbon(), and toHijri().

Out-of-range or impossible dates throw SDOSA\Exceptions\DateOutOfRange, InvalidHijriDate, or InvalidGregorianDate — all extend HijriException.

Locales

Four locales ship in the box: ar (default), en, bn (Bengali), tr (Turkish).

Pass a tag to any name method:

Or change the default used when no tag is passed:

In Laravel, set it in config/hijri.php (or the HIJRI_LOCALE env var) instead — the service provider applies it on boot. Unknown tags fall back to the default, so a missing translation never breaks a call.

Laravel

The service provider is auto-discovered. The core API is static, so there is no facade to register — just call SDOSA\Hijri anywhere. The provider wires up config, the default locale, and Carbon macros.

Try it

Credits

The Umm al-Qura dataset and conversion algorithm derive from dralshehri/hijridate (MIT). See LICENSE.


All versions of hijri-converter with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
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 sdo-sa/hijri-converter contains the following files

Loading the files please wait ...