ernilambar/nepali-date
Composer 安装命令:
composer require ernilambar/nepali-date
包简介
Nepali (Bikram Sambat) calendar utilities and BS ↔ AD date conversion for PHP.
关键字:
README 文档
README
Nepali (Bikram Sambat) calendar utilities and BS ↔ AD (Gregorian) date conversion for PHP. This package converts between BS and AD dates and exposes helpers for formatted labels (English or Nepali script).
Requirements
- PHP 5.6+.
- Composer for managing PHP dependencies.
Installation
Install the package with Composer (see Packagist):
composer require ernilambar/nepali-date
Autoloading
Require Composer’s autoload once from your project root (where vendor/ lives).
require_once __DIR__ . '/vendor/autoload.php';
Usage
Examples use integers for year, month, and day. The API also accepts numeric strings (e.g. '2077') where values are used numerically.
use Nilambar\NepaliDate\NepaliDate; $obj = new NepaliDate(); // Convert BS to AD. $date = $obj->convertBsToAd(2077, 1, 1); // Convert AD to BS. $date = $obj->convertAdToBs(2020, 1, 1); // Date details for a BS date (language: 'en' or 'np' for Devanagari numerals / labels). $date = $obj->getDetails(2077, 1, 1, 'bs', 'en'); $date = $obj->getDetails(2077, 1, 1, 'bs', 'np'); // Date details for an AD date (converted internally, then formatted like BS). $date = $obj->getDetails(2020, 1, 1, 'ad', 'en');
getDetails( $year, $month, $day, $type, $language ): $type is 'bs' or 'ad'; $language is optional and defaults to 'en'.
Supported ranges
Conversions rely on a fixed embedded calendar table. In practice:
- Gregorian (AD): years 1944–2033 are considered by the range checks; only dates that exist in the table can be converted (the first supported pair is 1944-01-01 ↔ BS 2000-09-17, and the last supported AD day in the current data is 2033-04-13 ↔ BS 2089-12-30).
- Bikram Sambat (BS): years 2000–2089 are in range; individual month/day combinations must still exist in the table (invalid or out-of-range inputs typically yield an empty array from conversion methods).
Copyright and License
This project is licensed under the MIT.
2026 © Nilambar Sharma.
ernilambar/nepali-date 适用场景与选型建议
ernilambar/nepali-date 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12.71k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2020 年 06 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「date」 「calendar」 「conversion」 「converter」 「ad」 「gregorian」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ernilambar/nepali-date 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ernilambar/nepali-date 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ernilambar/nepali-date 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A library that provides a simple infrastructure to create your own converters and to perform any conversion you want
Tools to convert between .NET and PHP date formats
A modern PHP library for generating iCalendar v2.0 events
A powerful event calendar Tool for Laravel's Nova 5.
Date component is a set of methods to help with the manipulation of dates.
Check for holidays - localeaware
统计信息
- 总下载量: 12.71k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-06-09