Download the PHP package danialzash/laravel-jalali without Composer
On this page you can find all versions of the php package danialzash/laravel-jalali. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download danialzash/laravel-jalali
More information about danialzash/laravel-jalali
Files in danialzash/laravel-jalali
Package laravel-jalali
Short Description Laravel helpers for Jalali (Shamsi) date formatting
License MIT
Informations about the package laravel-jalali
Laravel Jalali
A Laravel package that provides seamless Jalali (Shamsi/Persian) date formatting with Carbon integration.
Requirements
- PHP 8.1+
- Laravel 10, 11, or 12
Installation
Install the package via Composer:
The package will auto-register its service provider and facade.
Publish Configuration (Optional)
This will create a config/jalali.php file where you can set the default date format:
Usage
Using the Helper Function
The simplest way to convert dates to Jalali:
Using the Facade
Using Carbon Macros
The package adds two macros to Laravel's Carbon class:
Working with Jalalian
The toJalali() method returns a Morilog\Jalali\Jalalian instance, giving you access to all its methods:
Format Characters
Common format characters (from morilog/jalali):
| Character | Description | Example |
|---|---|---|
Y |
Full year | 1402 |
y |
Two-digit year | 02 |
m |
Month (zero-padded) | 01-12 |
n |
Month | 1-12 |
d |
Day (zero-padded) | 01-31 |
j |
Day | 1-31 |
H |
Hour (24-hour, zero-padded) | 00-23 |
i |
Minutes (zero-padded) | 00-59 |
s |
Seconds (zero-padded) | 00-59 |
F |
Full month name | فروردین |
l |
Full day name | شنبه |
D |
Short day name | ش |
Examples
Testing
Credits
- Danial Zash
- morilog/jalali - The underlying Jalali date library
License
The MIT License (MIT). Please see License File for more information.