Search by

itashia / laravel-jalali

itashia

A lightweight, modern Laravel package for Jalali (Persian) date and time conversion, formatting, parsing, and manipulation, with seamless Carbon and Eloquent integration.

Package info

github.com/itashia/laravel-jalali

pkg:composer/itashia/laravel-jalali

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-11-10 12:17 UTC

This package is auto-updated.

Last update: 2026-11-10 12:23:18 UTC


README

Immutable Jalali date/time conversion for Laravel and PHP. فارسی

composer require itashia/laravel-jalali

Requires PHP 8.3+ and Laravel 12 or 13. Composer discovers the provider and Jalali facade.

$date = jalali('1405/08/19');       // strict Jalali YYYY/MM/DD
$date->format('Y/m/d H:i:s');
$fromCarbon = jalali(now());        // Carbon is a Gregorian instant
$fromNative = jalali(new DateTimeImmutable());
$date->addDays(10)->subMonths(2);   // immutable
$date->toCarbon();

jalali() without arguments uses the package factory and configured timezone. Strings are Jalali dates; DateTimeInterface values are Gregorian. Invalid strings raise InvalidDate. See complete English docs and Persian docs.

use Jalali\Jalali\Facades\Jalali;
Jalali::now()->format('Y/m/d');

Eloquent casts are JalaliDateTimeCast for timestamps and JalaliDateCast for date-only storage. Validation uses new JalaliDate(). Publish settings and translations with php artisan vendor:publish --tag=laravel-jalali.

Run checks with composer test; run composer audit --locked for dependency advisories. License: MIT.