PHPackages                             melakudemeke/kenat-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. melakudemeke/kenat-php

ActiveLibrary

melakudemeke/kenat-php
======================

A modern PHP library for the Ethiopian calendar: date conversion, formatting, arithmetic, calendar grids, and a full Bahire Hasab implementation.

v1.0.0(1mo ago)10MITPHPPHP &gt;=8.1

Since Jul 12Pushed 1mo agoCompare

[ Source](https://github.com/MelakuDemeke/kenat-php)[ Packagist](https://packagist.org/packages/melakudemeke/kenat-php)[ Docs](https://www.kenat.systems/)[ RSS](/packages/melakudemeke-kenat-php/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Kenat PHP / ቀናት
===============

[](#kenat-php--ቀናት)

A modern PHP library for the Ethiopian calendar: bidirectional Ethiopian ↔ Gregorian date conversion, Amharic/English/Geez formatting, date arithmetic, calendar grid generation, and a full **Bahire Hasab (ባሕረ ሃሳብ)** implementation for computing movable religious holidays and fasting periods.

This is a PHP port of [`kenat`](https://github.com/MelakuDemeke/kenat) (the JavaScript/TypeScript original), sharing the same holiday data, Bahire Hasab algorithm, and API shape — adapted to idiomatic, typed, modern PHP (PHP 8.1+, PSR-4, immutable value objects, zero runtime dependencies).

Features
--------

[](#features)

- **Bidirectional conversion** between Ethiopian and Gregorian calendars.
- **Calendar preference**: read or format any date as Ethiopian *or* Gregorian.
- **Complete holiday system**: public, religious (Christian &amp; Muslim), and cultural holidays, filterable by tag.
- **Bahire Hasab (ባሕረ ሃሳብ)**: the traditional algorithm for movable feasts and fasts.
- **Localized formatting**: Amharic and English, including Geez numerals.
- **Full date arithmetic**: add/subtract days, months, years across the 13-month calendar.
- **Start/end of period**, date comparison, distance/diff helpers.
- **Ethiopian time**: 12-hour day/night time system, with conversion to/from Gregorian 24-hour time.
- **Calendar grid generation**: month/year grids with holiday and Orthodox saints-day overlays.
- **Fasting periods**: Lent, Nineveh, Ramadan, and more.
- **Immutable &amp; chainable**: every method that changes a date returns a *new* `Kenat` instance.
- **Zero runtime dependencies.**

Installation
------------

[](#installation)

```
composer require melakudemeke/kenat-php
```

Requires PHP 8.1 or later.

Quick Start
-----------

[](#quick-start)

```
use Kenat\Kenat;

$today = new Kenat();
echo $today->format(); // e.g. "ጥቅምት 5 2018"

$date = new Kenat('2016/10/5');
echo $date->formatInGeezAmharic(); // "ሰኔ ፭ ፳፻፲፮"
echo $date->getGregorian()->year;  // 2024

$nextWeek = $date->addDays(7);
echo $nextWeek->formatShort(); // "2016/10/12"
```

Date Conversion
---------------

[](#date-conversion)

```
use Kenat\Conversions;

$gregorian = Conversions::toGC(2016, 1, 1); // GregorianDate{ year: 2023, month: 9, day: 12 }
$ethiopian = Conversions::toEC(2024, 6, 7); // EthiopianDate{ year: 2016, month: 10, day: 7 }
```

Holidays &amp; Bahire Hasab
---------------------------

[](#holidays--bahire-hasab)

```
use Kenat\BahireHasab;
use Kenat\Holidays;
use Kenat\HolidayTags;

$bahireHasab = BahireHasab::calculate(2016);
echo $bahireHasab['evangelist']['name']; // "ዮሐንስ"
echo $bahireHasab['movableFeasts']['fasika']->ethiopian->day; // 27 (Fasika/Easter)

$publicHolidays = Holidays::getHolidaysForYear(2016, ['filter' => HolidayTags::PUBLIC]);
foreach ($publicHolidays as $holiday) {
    echo "{$holiday->name}: {$holiday->ethiopian->month}/{$holiday->ethiopian->day}\n";
}
```

Date Arithmetic &amp; Comparison
--------------------------------

[](#date-arithmetic--comparison)

```
use Kenat\Kenat;

$k = new Kenat('2015/6/10');
$result = $k->addDays(5)->addMonths(-1)->addYears(2);
// { year: 2017, month: 5, day: 15 }

$a = new Kenat('2016/06/10');
$b = new Kenat('2016/06/05');
$a->diffInDays($b); // 5
$a->isAfter($b);    // true
```

Calendar Grid Generation
------------------------

[](#calendar-grid-generation)

```
use Kenat\MonthGrid;

$grid = MonthGrid::create([
    'year' => 2016,
    'month' => 1,
    'mode' => 'christian', // 'public' | 'christian' | 'muslim' | null
    'weekdayLang' => 'amharic',
]);

echo $grid['monthName']; // "መስከረም"
foreach ($grid['days'] as $day) {
    if ($day === null) continue; // leading padding cell
    // $day['holidays'] includes fixed/movable holidays and, in 'christian'
    // mode, Orthodox monthly commemorations (Nigs days).
}
```

Ethiopian Time
--------------

[](#ethiopian-time)

```
use Kenat\Time;

$time = Time::fromGregorian(17, 30);
echo $time->format(); // "፲፩:፴ ጠዋት"

$time->toGregorian(); // ['hour' => 17, 'minute' => 30]
```

Fasting Periods
---------------

[](#fasting-periods)

```
use Kenat\Fasting;
use Kenat\FastingKeys;

$period = Fasting::getFastingPeriod(FastingKeys::ABIY_TSOME, 2016);
echo "{$period->start->month}/{$period->start->day} - {$period->end->month}/{$period->end->day}";
```

Design Notes
------------

[](#design-notes)

- **Value objects, not arrays**: `EthiopianDate`, `GregorianDate`, `Holiday`, `DateRange`, and `DiffBreakdown` are immutable, typed, `JsonSerializable` value objects rather than loose associative arrays, so IDEs and static analysis can follow the data through the API.
- **Static utility classes** (`Conversions`, `DayArithmetic`, `Formatting`, `GeezConverter`, `Holidays`, `BahireHasab`, `Fasting`, `Utils`) operate on those value objects — mirroring the original library's "pure functions operate on plain dates; `Kenat` is a thin stateful wrapper" architecture.
- **Islamic calendar dates** (Eid al-Fitr, Eid al-Adha, Moulid, Ramadan) are computed with a self-contained tabular Islamic calendar (Julian-Day-Number based), since PHP has no built-in equivalent to the JS original's ICU `islamic` calendar binding without requiring `ext-intl`. This can disagree with observation-based Islamic calendars by a day at some month boundaries — a known, accepted limitation, consistent with the project's other ports.
- **Orthodox saints data** (`resources/nigs.json`) is copied verbatim from the upstream `kenat`project and consumed by `MonthGrid` in `'christian'` mode.

Testing
-------

[](#testing)

```
composer install
composer test
```

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

Related Projects
----------------

[](#related-projects)

- [`kenat`](https://github.com/MelakuDemeke/kenat) — the original JavaScript/TypeScript library.
- [`kenat_py`](https://github.com/MelakuDemeke/kenat_py) — Python port.
- [`kenat-dart`](https://github.com/MelakuDemeke/kenat-dart) — Dart port.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance90

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

50d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/38818398?v=4)[Melaku Demeke](/maintainers/MelakuDemeke)[@MelakuDemeke](https://github.com/MelakuDemeke)

---

Top Contributors

[![MelakuDemeke](https://avatars.githubusercontent.com/u/38818398?v=4)](https://github.com/MelakuDemeke "MelakuDemeke (17 commits)")

---

Tags

timedatecalendarethiopianethiopian-calendardate-converterzemenkenathabeshaethiopian dategeez calendaramharic calendarcalendar converterethiopian holidaysbahire hasababushakir

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/melakudemeke-kenat-php/health.svg)

```
[![Health](https://phpackages.com/badges/melakudemeke-kenat-php/health.svg)](https://phpackages.com/packages/melakudemeke-kenat-php)
```

###  Alternatives

[azuyalabs/yasumi

The easy PHP Library for calculating holidays

1.1k13.8M44](/packages/azuyalabs-yasumi)[league/period

Time range API for PHP

7336.1M27](/packages/league-period)[aeon-php/calendar

PHP type safe, immutable calendar library

20910.8M16](/packages/aeon-php-calendar)[punic/punic

PHP-Unicode CLDR

1543.1M34](/packages/punic-punic)[umulmrum/holiday

A PHP library to compute holidays. It's something :-)

95415.7k1](/packages/umulmrum-holiday)[benhall14/php-calendar

A simple PHP class to generate calendars.

9931.4k](/packages/benhall14-php-calendar)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
