hekmatinasser/verta
This Package helps developers to work with Jalali Datetime class for Laravel Framework PHP
548,054
657
| Install | |
|---|---|
composer require hekmatinasser/verta |
|
| Latest Version: | v9.0 |
| PHP: | ^8.0 |
| License: | MIT |
| Last Updated: | May 8, 2026 |
| Links: | GitHub · Packagist |
Maintainer: hekmati.nasser
Quick view
- Installation
- Usage
- Getters
- Setters
- Formatting
- Modification
- Boundaries
- Compression
- Validation
- Localization
- Validation Request
- Licence
- Contributors
Installation
composer require hekmatinasser/verta
Usage
echo verta(); //1401-05-24 00:00:00
Gregorian to Jalali
echo verta('2022-08-15'); //1401-05-24 00:00:00
jalali to Gregorian
echo Verta::parse('1401-05-24 14:12:32')->datetime(); //2022-08-15 00:00:00
Carbon to Jalali
echo now()->toJalali(); //1401-05-24 00:00:00
Jalali to Carbon
echo verta()->toCarbon(); //2022-08-15 00:00:00
Getters
$v = verta(); // 1396-03-14 14:18:23
echo $v->year; // 1396
Setters
$v = verta(); // 1396-03-14 14:18:23
echo $v->year = 1395;
Fluent Setters
$v = verta(); // 1396-03-14 14:18:23
echo $v->setTimeString('12:25:45');
Formatting
echo verta()->format('Y.m.d'); // 1401.05.24
echo verta()->formatWord('l dS F'); // دوشنبه بیست و چهارم مرداد
Common Formats
echo verta()->formatJalaliDatetime(); // output 1395/10/07 14:12:25
Difference for Humans
echo verta('-13 month')->formatDifference(); // 1 سال قبل
Modification
echo verta()->addWeeks(3);
...
Boundaries
echo verta()->startWeek(3);
Compression
echo verta('+2 day')->gte('2022-08-15');
Difference
echo verta('+13 day')->diffMonths('2022-08-15');
Validation
echo Verta::isLeapYear(1394); // false
Localization
Verta::setLocale('ar');
Validation Request
'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.