eliasdebelo / ethiopian-calendar
Ethiopian โ Gregorian calendar conversion
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/eliasdebelo/ethiopian-calendar
Requires
- php: >=8.0
- ext-calendar: *
Requires (Dev)
- phpunit/phpunit: ^12.4
README
A modern, lightweight PHP library for seamless conversion between Ethiopian and Gregorian calendars. Ideal for applications serving Ethiopian users, historical calculations, and multicultural systems.
โจ Features
- ๐ Bidirectional Conversion --- Ethiopian โ Gregorian\
- ๐ Real-time Date Handling --- Get current dates in both calendars\
- โ Robust Validation --- Clear error messages for invalid dates\
- ๐ฏ Leap Year Support --- Accurate handling of Pagume 5/6 days\
- ๐ High Performance --- Zero dependencies, optimized calculations\
- ๐ช Type Safe --- PHP 8.0+ with strict type declarations\
- ๐งช Fully Tested --- PHPUnit test coverage included\
- ๐ English Month Names --- Avoid encoding issues
๐ฆ Installation
composer require eliasdebelo/ethiopian-calendar
๐ Quick Start
<?php require_once 'vendor/autoload.php'; use EliasDebelo\EthiopianCalendar\EthiopianCalendar; // Ethiopian โ Gregorian echo EthiopianCalendar::toGregorian(2015, 4, 25); // "2024-01-03" // Gregorian โ Ethiopian print_r(EthiopianCalendar::toEthiopian(2022, 3, 25)); // [2013, 7, 16] // Today's dates print_r(EthiopianCalendar::todayEthiopian()); echo EthiopianCalendar::todayGregorian(); // Format Ethiopian date echo EthiopianCalendar::format(2015, 1, 1, 'j M Y'); // "1 Meskerem 2015" // Leap year check echo EthiopianCalendar::isLeapYear(2015) ? 'Leap year' : 'Not leap year';
๐ API Reference
Conversion Methods
toGregorian(int $year, int $month, int $day): string\toEthiopian(int $year, int $month, int $day): array
Utilities
todayEthiopian(): array\todayGregorian(): string\format(int $year, int $month, int $day, string $format = "Y-m-d"): string\getDaysInMonth(int $year, int $month): int\getMonthName(int $month): string\isLeapYear(int $year): bool\isValidEthiopianDate(int $year, int $month, int $day): bool\getEthiopianNewYear(int $gregorianYear): array\getEthiopianNewYearDay(int $gregorianYear): int
๐๏ธ Ethiopian Calendar Structure
Month English Name Days Gregorian Equivalent
1 Meskerem 30 Sep--Oct 2 Tikimit 30 Oct--Nov 3 Hidar 30 Nov--Dec 4 Tahsas 30 Dec--Jan 5 Tir 30 Jan--Feb 6 Yekatit 30 Feb--Mar 7 Megabit 30 Mar--Apr 8 Miyazya 30 Apr--May 9 Ginbot 30 May--Jun 10 Sene 30 Jun--Jul 11 Hamle 30 Jul--Aug 12 Nehase 30 Aug--Sep 13 Pagume 5/6* Sep
*Pagume has 5 days in common years, 6 days in leap years.
๐งช Running Tests
composer install vendor/bin/phpunit --testdox vendor/bin/phpunit --coverage-html coverage
๐ง Requirements
- PHP 8.0+\
- Composer
๐ License
MIT License --- Open source.
๐ค Contributing
- Fork the repo\
- Create a branch (
git checkout -b feature/awesome)\ - Commit changes (
git commit -m "Add feature")\ - Push (
git push origin feature/awesome)\ - Open a Pull Request
๐ Issues & Support
- Repo: GitHub\
- Issues: GitHub Issues\
- Email: eliascs2012@gmail.com\
- Packagist: https://packagist.org/packages/eliasdebelo/ethiopian-calendar