PHPackages                             amir-anisheh/gregorian-jalali - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. amir-anisheh/gregorian-jalali

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

amir-anisheh/gregorian-jalali
=============================

A chainable, SOAP-like HTML parser for Laravel using pure PHP.

v1.0.0(8mo ago)10MITPHP

Since Sep 6Pushed 8mo agoCompare

[ Source](https://github.com/AmirAnisheh/gregorian-jalali)[ Packagist](https://packagist.org/packages/amir-anisheh/gregorian-jalali)[ RSS](/packages/amir-anisheh-gregorian-jalali/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Gregorian-Jalali Converter for Laravel
======================================

[](#gregorian-jalali-converter-for-laravel)

A simple **pure PHP package** to convert **Gregorian dates to Jalali (Persian) dates** and vice versa, designed to work easily with Laravel projects.
No external libraries required.

---

Features
--------

[](#features)

- Convert **Gregorian → Jalali**
- Convert **Jalali → Gregorian**
- Pure PHP implementation, no dependencies
- Easy to integrate into Laravel

---

Installation
------------

[](#installation)

### 1. Install via Packagist (Recommended)

[](#1-install-via-packagist-recommended)

Once the package is published on Packagist, you can install it using Composer:

```
composer require amir-anisheh/gregorian-jalali
```

Or, if you want a specific version:

```
composer require amir-anisheh/gregorian-jalali:^1.0
```

---

### 2. Install directly from GitHub

[](#2-install-directly-from-github)

If you haven’t published the package on Packagist yet, you can require it directly from GitHub:

1. Add the repository to your Laravel project’s `composer.json`:

```
{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/AmirAnisheh/gregorian-jalali.git"
    }
  ],
  "require": {
    "amir-anisheh/gregorian-jalali": "dev-main"
  }
}
```

2. Run Composer update:

```
composer update
```

---

### 3. Autoload

[](#3-autoload)

Composer will automatically autoload the package. Use it in your Laravel project:

```
use AmirAnisheh\GregorianJalali\JalaliConverter;

$jalali = JalaliConverter::toJalali(2025, 9, 6);
$gregorian = JalaliConverter::toGregorian(1404, 6, 15);
```

---

Usage
-----

[](#usage)

### 1. Import the converter

[](#1-import-the-converter)

```
use AmirAnisheh\GregorianJalali\JalaliConverter;
```

### 2. Convert Gregorian to Jalali

[](#2-convert-gregorian-to-jalali)

```
$jalali = JalaliConverter::toJalali(2025, 9, 6);
echo $jalali; // Output: 1404/06/15
```

### 3. Convert Jalali to Gregorian

[](#3-convert-jalali-to-gregorian)

```
$gregorian = JalaliConverter::toGregorian(1404, 6, 15);
echo $gregorian; // Output: 2025-09-06
```

---

Example in Laravel Controller
-----------------------------

[](#example-in-laravel-controller)

```
