API Reference
This section provides complete documentation for all classes, functions, and constants provided by the Nepali Date Library (PHP).
Main Exports
Classes
| Class | Description |
|---|---|
| NepaliDateLibrary\NepaliDate | Main class for working with Nepali dates |
Functions
| Function | Description |
|---|---|
| NepaliDateLibrary\ADtoBS | Convert AD (Gregorian) date to BS (Nepali) |
| NepaliDateLibrary\BStoAD | Convert BS (Nepali) date to AD (Gregorian) |
Constants
All constants live as static properties on NepaliDateLibrary\Helper\Constants.
| Constant | Description |
|---|---|
| Constants::$MONTH_EN | English month names |
| Constants::$MONTH_NP | Nepali month names |
| Constants::$MONTH_SHORT_EN | Short English month names |
| Constants::$MONTH_SHORT_NP | Short Nepali month names |
| Constants::$WEEK_EN | English weekday names |
| Constants::$WEEK_NP | Nepali weekday names |
| Constants::$WEEK_SHORT_EN | Short English weekday names |
| Constants::$WEEK_SHORT_NP | Short Nepali weekday names |
| Constants::$NUMBER_NP | Nepali digits (०-९) |
| Constants::$NEPALI_DATE_MAP | Complete 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.