islamic-network/calendar
A PHP library for working with the Islamic (Hijri) calendar. Convert dates between Gregorian and Hijri, format Islamic dates, and handle calendar calculations with a simple, lightweight API suitable for Laravel and other PHP applications.
Architecture fit
This is a narrow, single-purpose domain utility: bidirectional Gregorian↔Hijri date conversion. It is a pure computational library with no I/O, no persistence, and no framework coupling, which makes it architecturally cheap to adopt — it can live entirely inside a domain adapter or value-object layer without touching application infrastructure. The correct fit is as an implementation detail behind your own interface (e.g., HijriConverter), not as a type that leaks into controllers, models, or API contracts. If your product only needs to display a Hijri date alongside a Gregorian one, this is close to a drop-in. If your product needs to reason about Hijri dates (scheduling, recurring events, billing cycles, cutoffs), the library gives you conversion but not calendar arithmetic, and you will own that layer.
Integration feasibility High. Composer-installable, no extension or service dependencies, deterministic output. A Laravel integration is a thin service provider plus a facade or injected class — perhaps 30–60 lines. The real feasibility question is not technical but policy: Hijri dates are determined by convention (Umm al-Qura arithmetic, tabular 30-year cycle, or local moon sighting), and these routinely disagree by ±1 day. The library's adjustment/offset parameter is the lever for this, but choosing the value is a business decision, not an engineering one. Confirm the library exposes per-conversion or per-instance offset control before committing.
Technical risk
Key questions
DateTimeInterface or string dates, and does it do any timezone handling?Stack fit Excellent for Laravel/PHP. No queue workers, no caching mandatory, no external service. Wrap it, don't scatter it: one adapter class, one interface, one binding in a service provider. Bind the interface, not the concrete library, so a future swap (e.g., to an API-backed or table-backed convention) is a one-line container change.
Migration path There is nothing to migrate from unless you have hand-rolled conversion logic or embedded date tables — in which case run both in parallel against a golden dataset before cutting over. If this is greenfield, no migration is required; the only decision is where the boundary sits.
Compatibility
Check the PHP version constraint against your runtime (Laravel 10/11 implies PHP 8.1+). Low risk, but a stale constraint is the most common reason a small library fails composer require. Confirm no conflicting global function or class names.
Sequencing
Maintenance Runtime maintenance is near-zero: pure arithmetic, no dependencies, no network, no schema. The ongoing cost is convention maintenance — annually verifying that your chosen method still matches what your users expect, particularly around Ramadan, Eid, and the new Hijri year. Budget a small recurring review, not a support rota.
Support Support burden is low in volume but high in sensitivity. Users who report a date discrepancy are usually correct about their local observance and "correct" about the arithmetic simultaneously. Equip support with the convention documentation and a self-service explanation, or you will absorb avoidable escalations.
Scaling Effectively free. Conversion is microseconds and CPU-bound. If you render a month grid or a multi-year calendar, cache the computed grid keyed by (convention, offset, year, month) — this is a convenience, not a necessity.
Failure modes
Ramp-up A PHP developer is productive in under a day; the API is small and the domain is a lookup. The genuine ramp-up cost is domain literacy — understanding why two correct implementations disagree by a day. Assign one owner for the convention decision and document it in the repo. Total adoption estimate: 2–4 developer-days including tests and policy sign-off.
How can I help you explore Laravel packages today?