wasinpwg/carbon-buddhist-macros

This is my package carbon-buddhist-macros

v0.1.2 2024-06-07 02:32 UTC

This package is auto-updated.

Last update: 2024-09-08 04:27:03 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Enhance your application with Carbon Buddhist Year Macros. Easily format dates using the Buddhist calendar system. Support both Laravel and pure PHP.

Installation

You can install the package via composer:

composer require wasinpwg/carbon-buddhist-macros

Register

In case you want to use it in pure PHP, you can use the following code:

require __DIR__ . '/vendor/autoload.php';

(new Wasinpwg\CarbonBuddhistMacros\CarbonBuddhistMacros())->register();

If you are using Laravel, the package will auto-register the macro for you.

Usage

use Carbon\Carbon; // or use Illuminate\Support\Carbon in Laravel

echo Carbon::now()->buddhistYearFormat('d/m/Y H:i:s');
echo Carbon::now()->buddhistYearTranslatedFormat('d/m/Y H:i:s');
$carbon = Carbon::createFromBuddhistYearFormat('d/m/Y', '01/01/2567');

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.