Nepali DateNepali DateBikram Sambat Date Engine

PackagistOverview

Complete documentation and feature guide for the Nepali Date Library in PHP applications.

The Nepali Date Library for PHP provides a modern object oriented toolkit with zero external dependencies for Bikram Sambat calendar operations. It handles bidirectional conversion between Bikram Sambat and Gregorian calendars, date arithmetic, custom string formatting, fiscal year calculations, and calendar grid generation for PHP web applications and enterprise systems.


Installation

Install the package via Composer:

composer require sghimire/nepali-date-library

Quick Example

<?php

require 'vendor/autoload.php';

use NepaliDateLibrary\NepaliDate;
use function NepaliDateLibrary\ADtoBS;
use function NepaliDateLibrary\BStoAD;

// Current Nepali date
$today = new NepaliDate();
echo $today->format('YYYY-MM-DD');

// Specific Bikram Sambat date (month 0 is Baisakh)
$event = new NepaliDate(2081, 6, 15);
echo $event->format('dddd, MMMM DD, YYYY');

// Standalone date conversion helpers
$bsDate = ADtoBS('2024-11-15');
$adDate = BStoAD('2081-07-30');

Feature Matrix

FeatureSupportDescription
Bikram Sambat Calendar EngineYesCalendar matrix spanning 1976 through 2100 BS, audited and updated annually each Ashwin.
Bidirectional AD to BS ConversionYesStandalone conversion functions and full object instances.
Date ArithmeticYesAdd and subtract days, months, and years with automatic rollover.
Fiscal Year OperationsYesOfficial Nepalese fiscal calendar starting on 1 Shrawan.
Custom Format PatternsYesToken formatting for year, month, weekday, and Devanagari script.
Calendar Grid BuilderYesForty two cell matrix generation for calendar interfaces.

Package Information

SpecificationDetails
Composer Packagesghimire/nepali-date-library
RepositoryGitHub
Supported PHPPHP 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4+
LicenseMIT License
Advertisement

On this page