wasinpwg/carbon-buddhist-macros

这是我创建的包 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

使用 Carbon Buddhist 年份宏增强您的应用程序。轻松使用佛教日历系统格式化日期。支持 Laravel 和纯 PHP。

安装

您可以通过 composer 安装此包

composer require wasinpwg/carbon-buddhist-macros

注册

如果您想用纯 PHP 使用它,可以使用以下代码

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

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

如果您使用 Laravel,包会自动为您注册宏。

使用方法

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');

测试

composer test

变更日志

请参阅 CHANGELOG 了解最近更改的详细信息。

鸣谢

许可证

MIT 许可证 (MIT)。请参阅 许可证文件 了解更多信息。