proshore / nepali-date-converter
Package to convert carbon date to nepali date
Requires
- php: ^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.51
- orchestra/testbench: ^8.21
- pestphp/pest: ^2.34
- phpstan/phpstan-phpunit: ^1.3
- phpunit/phpunit: ^10.5
This package is auto-updated.
Last update: 2025-01-06 06:33:56 UTC
README
This Laravel package provides functionality to convert dates from the Gregorian calendar (AD) to the Bikram Sambat calendar (BS) using the native Carbon library. It's especially useful for applications targeting Nepali users or systems where Bikram Sambat dates are relevant.
Features
- Seamless conversion of dates from AD to BS and vice versa.
- Integration with Laravel's native Carbon library for efficient and accurate date manipulation.
- Simple to integrate into existing Laravel applications.
Requirements
- PHP >= 8.0
- Carbon PHP Library
Installation
Composer
Install using composer
composer require proshore/laravel-nepali-date-converter
Publish your config file
php artisan vendor:publish --tag=nepali-date
Usages
You can directly convert Carbon date to Nepali date using chain function in Carbon.
Carbon\Carbon::now()->toBS();
Get Formatted date
Carbon\Carbon::now()->toBSDate();
Carbon\Carbon::now()->toBSFormattedDate();
Using without carbon
Proshore\NepaliDate\Facades\NepaliDateConverter::getBSbyAd(2024,03,01);
Proshore\NepaliDate\Facades\NepaliDateConverter::getADbyBS(2080,11,18);
Get Carbon date from Bs Date
Proshore\NepaliDate\Facades\NepaliDateConverter::toAD(2080,11,18);