Skip to content

API Reference ​

This section provides complete documentation for all classes, functions, and constants provided by the Nepali Date Library (PHP).

Main Exports ​

Classes ​

ClassDescription
NepaliDateLibrary\NepaliDateMain class for working with Nepali dates

Functions ​

FunctionDescription
NepaliDateLibrary\ADtoBSConvert AD (Gregorian) date to BS (Nepali)
NepaliDateLibrary\BStoADConvert BS (Nepali) date to AD (Gregorian)

Constants ​

All constants live as static properties on NepaliDateLibrary\Helper\Constants.

ConstantDescription
Constants::$MONTH_ENEnglish month names
Constants::$MONTH_NPNepali month names
Constants::$MONTH_SHORT_ENShort English month names
Constants::$MONTH_SHORT_NPShort Nepali month names
Constants::$WEEK_ENEnglish weekday names
Constants::$WEEK_NPNepali weekday names
Constants::$WEEK_SHORT_ENShort English weekday names
Constants::$WEEK_SHORT_NPShort Nepali weekday names
Constants::$NUMBER_NPNepali digits (०-९)
Constants::$NEPALI_DATE_MAPComplete date map for BS 1976-2100

Quick Import ​

php
<?php

require 'vendor/autoload.php';

// Main class
use NepaliDateLibrary\NepaliDate;

// Conversion functions
use function NepaliDateLibrary\ADtoBS;
use function NepaliDateLibrary\BStoAD;

// Constants
use NepaliDateLibrary\Helper\Constants;

Namespaces vs. NodeJS/Python

NodeJS and Python export constants as top-level bindings you import directly (MONTH_EN, NEPALI_DATE_MAP, ...). PHP groups them as static properties on NepaliDateLibrary\Helper\Constants instead, since PHP has no bare named exports outside of classes/functions — everything else about the API (method names, argument order, return shapes) is identical.

Released under the MIT License.