hekmatinasser/verta
Composer 安装命令:
composer require hekmatinasser/verta
包简介
This Package helps developers to work with Jalali Datetime class for Laravel Framework PHP
README 文档
README
hekmatinasser/verta
The Verta is package for change solar calendar and gregorian together and provide helper function to use date and time.
Verta extend class PHP Datetime and Jalali, compatible with Carbon Package.
This package has been created by Nasser Hekmati under the license of MIT.
Quick view
- Installation
- Usage
- Getters
- Setters
- Formatting
- Modification
- Boundaries
- Compression
- Validation
- Localization
- Validation Request
- Licence
- Contributors
Installation
composer require hekmatinasser/verta
| Laravel Version | Package Version |
|---|---|
| 8.0 | 8.0 |
| 9.0 | 8.2 |
| 10.0 | 8.3 |
| 11.0 | 8.4 |
| 12.0 | 8.5 |
Usage
use verta datetime jalali
echo verta(); //1401-05-24 00:00:00
Gregorian to Jalali
change gregorian to jalali and reverse
echo verta('2022-08-15'); //1401-05-24 00:00:00
jalali to Gregorian
change jalali to gregorian and reverse
echo Verta::parse('1401-05-24 14:12:32')->datetime(); //2022-08-15 00:00:00
Carbon to Jalali
change carbon to jalali and reverse
echo now()->toJalali(); //1401-05-24 00:00:00
Jalali to Carbon
change jalali to gregorian and reverse
echo verta()->toCarbon(); //2022-08-15 00:00:00
Getters
access part of jalali datetime
$v = verta(); // 1396-03-14 14:18:23 echo $v->year; // 1396
Setters
set part of jalali datetime
$v = verta(); // 1396-03-14 14:18:23 echo $v->year = 1395;
Fluent Setters
set multiple part of jalali datetime
$v = verta(); // 1396-03-14 14:18:23 echo $v->setTimeString('12:25:45');
Formatting
show datetime variant datetime
echo verta()->format('Y.m.d'); // 1401.05.24 echo verta()->formatWord('l dS F'); // دوشنبه بیست و چهارم مرداد
Common Formats
show common datetime variant datetime
echo verta()->formatJalaliDatetime(); // output 1395/10/07 14:12:25
Difference for Humans
show difference format readable humans
echo verta('-13 month')->formatDifference(); // 1 سال قبل
Modification
manipulate jalali datetime
echo verta()->addWeeks(3); ...
Boundaries
get boundary jalali datetime
echo verta()->startWeek(3);
Compression
get compression jalali datetime
echo verta('+2 day')->gte('2022-08-15');
Difference
calculate difference two jalali datetime
echo verta('+13 day')->diffMonths('2022-08-15');
Validation
check datetime check is valid
echo Verta::isLeapYear(1394); // false
Localization
set language for formatting datetime
Verta::setLocale('ar');
Validation Request
validation input form
'birthday' => ['required', 'jdate_before_equal']
Licence
This package has been created by Nasser Hekmati under the license of MIT.
Contributors
Thanks to people who contributed for grow verta.
hekmatinasser/verta 适用场景与选型建议
hekmatinasser/verta 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 552.17k 次下载、GitHub Stars 达 657, 最近一次更新时间为 2017 年 02 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「date」 「laravel」 「datetime」 「Jalali」 「shamsi」 「Verta」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hekmatinasser/verta 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hekmatinasser/verta 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hekmatinasser/verta 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Tools to convert between .NET and PHP date formats
Time provider, providing consistent current date, time, datetime and timezone across the request.
Adds the EDTF data type to Wikibase
Datetime helpers for timezone handling
A custom Doctine DBAL type to use PHP DateTime objects set to the system's default timezone.
A powerful event calendar Tool for Laravel's Nova 5.
统计信息
- 总下载量: 552.17k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 663
- 点击次数: 35
- 依赖项目数: 37
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-02-27
