itashia / laravel-jalali
A lightweight, modern Laravel package for Jalali (Persian) date and time conversion, formatting, parsing, and manipulation, with seamless Carbon and Eloquent integration.
Requires
- php: ^8.3
- illuminate/support: ^12.0||^13.0
- nesbot/carbon: ^3.0
Requires (Dev)
- larastan/larastan: ^3.9
- laravel/pao: ^1.0
- laravel/pint: ^1.29
- orchestra/testbench: ^10.0||^11.0
- pestphp/pest: ^4.6||^5.0
- pestphp/pest-plugin-laravel: ^4.1||^5.0
- pestphp/pest-plugin-type-coverage: ^4.0||^5.0
- phpstan/extension-installer: ^1.4
- symfony/process: ^7.2||^8.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
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.