omalizadeh/laravel-jalali-calendar

A laravel package to get jalali events from time.ir

v1.0.1 2022-09-03 15:29 UTC

This package is auto-updated.

Last update: 2024-04-30 00:45:42 UTC


README

License Tests Latest Stable Version Total Downloads

Laravel Jalali Calendar

This is a laravel package to get jalali date events and holidays by parsing time.ir website.

⭐ Star! if you used & liked this package.

Installation

Install package with composer:

composer require omalizadeh/laravel-jalali-calendar

Usage

Get a JalaliDate object by calling fromGregorian static method on JalaliCalendar class. example:

    use Omalizadeh\JalaliCalendar\JalaliCalendar;

    $jalaliDate = JalaliCalendar::fromGregorian('2020-05-24');

Or you can get a collection of JalaliDate objects by giving a gregorian period.

    use Omalizadeh\JalaliCalendar\JalaliCalendar;

    $jalaliDates = JalaliCalendar::fromGregorianPeriod('2020-05-24', '2020-05-28');

Then you can get different info from JalaliDate object. supported methods:

Methods Return type Description
format() string Jalali date with given format
isHoliday() bool Check jalali date is holiday
events() array Get date's events

License

  • Laravel Jalali Calendar is open-sourced software licensed under the MIT license.
  • This package is created based on Persiancalapi project.