change readme

This commit is contained in:
nasser committed 2022-08-25 21:46:31 +04:30
1 parent 31da55d8d3
commit e598f3d531
1 file changed
+90 -32
+90 -32
View File
@@ -8,9 +8,7 @@
<a href="https://packagist.org/packages/hekmatinasser/verta"><img src="https://poser.pugx.org/hekmatinasser/verta/license" alt="License"></a> <a href="https://packagist.org/packages/hekmatinasser/verta"><img src="https://poser.pugx.org/hekmatinasser/verta/license" alt="License"></a>
</p> </p>
<p align="center"> <h2 align="center"><a href="https://hekmatinasser.github.io/verta">Document</a></h2>
<a href="https://hekmatinasser.github.io/verta">Document</a>
</p>
<p align="center">The Verta is package for change solar calendar and gregorian together and provide helper function to use date and time.</p> <p align="center">The Verta is package for change solar calendar and gregorian together and provide helper function to use date and time.</p>
<p align="center">Verta extend class PHP Datetime and Jalali, compatible with Carbon Package.</p> <p align="center">Verta extend class PHP Datetime and Jalali, compatible with Carbon Package.</p>
@@ -29,18 +27,18 @@
- [Fluent Setters](#fluent-setters) - [Fluent Setters](#fluent-setters)
- [Formatting](#formatting) - [Formatting](#formatting)
- [Common Formats](#common-formats) - [Common Formats](#common-formats)
- [Difference for Humans](#difference-for-humans)
- [Modification](#modification) - [Modification](#modification)
- [Boundaries](#boundaries) - [Boundaries](#boundaries)
- [Compression](#compression) - [Compression](#compression)
- [Difference](#difference) - [Difference](#difference)
- [Difference for Humans](#difference-for-humans)
- [Validation](#validation) - [Validation](#validation)
- [Localization](#localization) - [Localization](#localization)
- [Validation Request](#validation-request) - [Validation Request](#validation-request)
- [Licence](#licence) - [Licence](#licence)
- [Contributors](#contributors) - [Contributors](#contributors)
## Installations ### Installation
```shell ```shell
composer require hekmatinasser/verta composer require hekmatinasser/verta
@@ -65,104 +63,164 @@ composer require hekmatinasser/verta
</tbody> </tbody>
</table> </table>
## Usage ### Usage
<p>use verta datetime jalali</p> <p>use verta datetime jalali</p>
```php ```php
echo verta(); //1401-05-24 00:00:00 echo verta(); //1401-05-24 00:00:00
``` ```
### Gregorian to Jalali #### Gregorian to Jalali
<p>change gregorian to jalali and reverse</p> <p>change gregorian to jalali and reverse</p>
```php ```php
echo verta('2022-08-15'); //1401-05-24 00:00:00 echo verta('2022-08-15'); //1401-05-24 00:00:00
``` ```
### jalali to Gregorian #### jalali to Gregorian
<p>change jalali to gregorian and reverse</p> <p>change jalali to gregorian and reverse</p>
```php ```php
echo Verta::parse('1401-05-24 14:12:32')->datetime(); //2022-08-15 00:00:00 echo Verta::parse('1401-05-24 14:12:32')->datetime(); //2022-08-15 00:00:00
``` ```
### Carbon to Jalali #### Carbon to Jalali
<p>change carbon to jalali and reverse</p> <p>change carbon to jalali and reverse</p>
```php ```php
echo now()->toJalali(); //1401-05-24 00:00:00 echo now()->toJalali(); //1401-05-24 00:00:00
``` ```
### Jalali to Carbon #### Jalali to Carbon
<p>change jalali to gregorian and reverse</p> <p>change jalali to gregorian and reverse</p>
```php ```php
echo verta()->toCarbon(); //2022-08-15 00:00:00 echo verta()->toCarbon(); //2022-08-15 00:00:00
``` ```
[view more function](https://hekmatinasser.github.io/verta/#instantiate)
<h2>Property</h2> ### Getters
<p>access part of jalali datetime</p> <p>access part of jalali datetime</p>
```php ```php
$v = verta(); // 1396-03-14 14:18:23 $v = verta(); // 1396-03-14 14:18:23
echo $v->year; // 1396 echo $v->year; // 1396
...
``` ```
[view more getter](https://hekmatinasser.github.io/verta/#getter)
<h2>Formation</h2> ### Setters
<p>set part of jalali datetime</p>
```php
$v = verta(); // 1396-03-14 14:18:23
echo $v->year = 1395;
```
[view more setter](https://hekmatinasser.github.io/verta/#setter)
#### Fluent Setters
<p>set multiple part of jalali datetime</p>
```php
$v = verta(); // 1396-03-14 14:18:23
echo $v->setTimeString('12:25:45');
```
[view more fluent setter](https://hekmatinasser.github.io/verta/#set_date_time)
### Formatting
<p>show datetime variant datetime</p> <p>show datetime variant datetime</p>
```php ```php
echo verta('-13 month')->formatDifference(); // 1 سال قبل echo verta()->format('Y.m.d'); // 1401.05.24
echo verta()->formatWord('l dS F'); // دوشنبه بیست و چهارم مرداد echo verta()->formatWord('l dS F'); // دوشنبه بیست و چهارم مرداد
...
``` ```
[view more format](https://hekmatinasser.github.io/verta/#formatting)
<h2>Modification</h2>
#### Common Formats
<p>show common datetime variant datetime</p>
```php
echo verta()->formatJalaliDatetime(); // output 1395/10/07 14:12:25
```
[view more common format](https://hekmatinasser.github.io/verta/#format_date_time)
### Difference for Humans
<p>show difference format readable humans</p>
```php
echo verta('-13 month')->formatDifference(); // 1 سال قبل
```
[view more format difference](https://hekmatinasser.github.io/verta/#format_difference)
### Modification
<p>manipulate jalali datetime</p> <p>manipulate jalali datetime</p>
```php ```php
echo verta()->addWeeks(3); echo verta()->addWeeks(3);
... ...
``` ```
[view more modifications](https://hekmatinasser.github.io/verta/#modification)
<h2>Boundaries</h2> ### Boundaries
<p>get boundary jalali datetime</p> <p>get boundary jalali datetime</p>
```php ```php
echo verta()->startWeek(3); echo verta()->startWeek(3);
...
``` ```
[view more boundaries](https://hekmatinasser.github.io/verta/#boundaries)
<h2>Difference</h2> ### Compression
<p>calculate diff two jalali datetime</p> <p>get compression jalali datetime</p>
```php
echo verta('+13 day')->diffMonths('2022-08-15');
...
```
<h2>Compression</h2>
<p>get boundary jalali datetime</p>
```php ```php
echo verta('+2 day')->gte('2022-08-15'); echo verta('+2 day')->gte('2022-08-15');
...
``` ```
[view more compression](https://hekmatinasser.github.io/verta/#comparison)
<h2>Validation Request</h2> #### Difference
<p>calculate difference two jalali datetime</p>
```php
echo verta('+13 day')->diffMonths('2022-08-15');
```
[view more differences](https://hekmatinasser.github.io/verta/#comparison)
### Validation
<p>check datetime check is valid </p>
```php
echo Verta::isLeapYear(1394); // false
```
[view more validations](https://hekmatinasser.github.io/verta/#validation)
### Localization
<p>set language for formatting datetime</p>
```php
Verta::setLocale('ar');
```
[view more localizations](https://hekmatinasser.github.io/verta/#translation)
### Validation Request
<p>validation input form</p> <p>validation input form</p>
```php ```php
'birthday' => ['required', 'jdate_before_equal'] 'birthday' => ['required', 'jdate_before_equal']
...
``` ```
[view more localizations](https://hekmatinasser.github.io/verta/#laravel_validation)
## Licence ## Licence
This package has been created by Nasser Hekmati under the license of MIT. This package has been created by Nasser Hekmati under the license of MIT.
## Contributors ## Contributors
Thanks to people who contributed for grow varta. Thanks to people who contributed for grow verta.
<a href="https://github.com/hekmatinasser/verta/graphs/contributors"><img src="https://opencollective.com/verta/contributors.svg?button=false" /></a> <a href="https://github.com/hekmatinasser/verta/graphs/contributors"><img src="https://opencollective.com/verta/contributors.svg?button=false" /></a>