Download the PHP package sagartimilsina/nepali-date without Composer

On this page you can find all versions of the php package sagartimilsina/nepali-date. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package nepali-date

Nepali Date Converter for PHP & Laravel

Latest Version PHP Version

This package converts dates between Nepali (BS) and English (AD) calendars.

It works in plain PHP and also in Laravel (versions 10, 11, 12, and 13). If you use Laravel, it sets itself up automatically — you don't need to register anything.

Coming from version 1.x? In version 2.0.0, adToBs() and bsToAd() now give you a full object with lots of details, instead of just a plain text string. See CHANGELOG.md if you need the old string-only behavior — it's still there under different method names.


What this package can do


What you need before installing


How to install it

Run this command in your project folder:

That's it — if you're using Laravel, it's ready to use right away.

If you want to change any settings later, publish the config file:


How to use it (Laravel)

Convert an English date to a Nepali date:

Convert a Nepali date to an English date:


All the available methods

Main methods (recommended)

Method What you give it What you get back
adToBs an AD date full details (year, month, day, weekday, etc.)
bsToAd a BS date an AD date (Carbon object)
toCarbon a BS date same as bsToAd()
todayBS nothing today's date in BS, with full details
todayAD nothing today's date in AD
nowBS nothing the current BS date and time
nowAD nothing the current AD date and time
getSupportedYearRange nothing the earliest and latest year this package supports

What you get back from adToBs()

You can access What it means
$year, $month, $day the numbers
$monthNameEn, $monthNameNp month name in English / Nepali
$weekdayEn, $weekdayNp day of week in English / Nepali
$formattedEn, $formattedNp ready-to-display text, e.g. "24 Ashadh 2083"
$carbon the matching English date, as a normal Carbon date
toDateString() gives you "2083-03-24"

Old methods from version 1.x (still work, just simpler output)

If you're on an older version and don't want to change your code, these still work and just return plain text instead of a full object:

adToBsString, bsToAdString, bsToNepaliText, format, getMonth, getDay, getDayName, today


Using it without Laravel


Try it out with the built-in demo page

This package includes a ready-made web page where you can type a date and see it converted instantly. It's turned off by default for safety — it won't show up on your site unless you turn it on.

To turn it on, add this to your .env file:

Then visit /nepali-date-demo in your browser.

⚠️ Remember to turn this off before going live — it's only meant for testing on your own computer.


What happens if someone types an invalid date?

The package will stop and throw an error instead of silently giving a wrong answer:

If someone submits the demo form with bad data, it gets rejected before any conversion is even attempted.


How accurate is it?

The date table this package uses has been checked against another trusted Nepali date converter website, at several points between BS 2060 and 2083 — including New Year dates. All of them matched, including the correct day of the week.

Two honest notes:

Found a date that looks wrong? Please open an issue on GitHub with the date and a source, and it'll get fixed.


Running the tests

Or run PHPUnit directly:


Code style check


Want to understand how it works internally?

See ARCHITECTURE.md — it explains step by step what happens when you convert a date, and why the code is organized the way it is.


Version history

This package follows normal version numbering rules (Semantic Versioning). Full history is in CHANGELOG.md.


Want to contribute?

  1. Fork this repository
  2. Create a new branch for your change
  3. Run composer lint and composer test — make sure both pass
  4. Commit your change
  5. Push your branch
  6. Open a Pull Request

What's planned next


License

Free to use — MIT License.


Author

Sagar Timilsina — Laravel & Full Stack Developer

If this package was useful to you, a ⭐ on GitHub is always appreciated.


All versions of nepali-date with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
nesbot/carbon Version ^2.72 || ^3.0
illuminate/support Version ^10.0 || ^11.0 || ^12.0 || ^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sagartimilsina/nepali-date contains the following files

Loading the files please wait ...