eliasdebelo/ethiopian-calendar 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

eliasdebelo/ethiopian-calendar

最新稳定版本:v1.2.0

Composer 安装命令:

composer require eliasdebelo/ethiopian-calendar

包简介

Ethiopian ↔ Gregorian calendar conversion

README 文档

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.

PHP License Packagist Tests

✨ 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

  1. Fork the repo\
  2. Create a branch (git checkout -b feature/awesome)\
  3. Commit changes (git commit -m "Add feature")\
  4. Push (git push origin feature/awesome)\
  5. Open a Pull Request

🐛 Issues & Support

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-13