rahax/iranian-holidays

Laravel package for Iranian official holidays and working-day adjustments, sourced from time.ir.

Maintainers

Package info

github.com/rahax/iranian-holidays

pkg:composer/rahax/iranian-holidays

Transparency log

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-07-21 12:28 UTC

This package is auto-updated.

Last update: 2026-07-21 12:59:57 UTC


README

Laravel package for Iranian official holidays and working-day adjustments. Holidays are fetched from time.ir and stored as holiday-only rows.

Requirements

  • PHP 8.2+
  • Laravel 11 or 12

Installation

composer require rahax/iranian-holidays

Publish the config (optional) and run migrations:

php artisan vendor:publish --tag=iranian-holidays-config
php artisan migrate

Fill holidays

php artisan iranian-holidays:fill --years=5 --sync

Without --sync, a queued job is dispatched.

Prune old holidays

php artisan iranian-holidays:prune --sync

Schedule weekly prune in your app's routes/console.php:

use Illuminate\Support\Facades\Schedule;

Schedule::command('iranian-holidays:prune')->weeklyOn(0, '04:00');

Working-day service

use Morilog\Jalali\Jalalian;
use Rahax\IranianHolidays\Services\IranianHolidayService;

$service = app(IranianHolidayService::class);

$date = new Jalalian(1404, 1, 1);

$service->isOfficialHoliday($date);
$service->isNonWorkingDay($date); // Thursday, Friday, or official holiday
$service->adjustToWorkingDay($date); // advances to the next working day

Non-working days are Thursday, Friday, and any date present in iranian_holidays.

Configuration

Env Purpose
IRANIAN_HOLIDAYS_TIME_IR_API_KEY Override the bundled time.ir public client key (only needed if it rotates)
IRANIAN_HOLIDAYS_API_BASE_URL Default https://api.time.ir
IRANIAN_HOLIDAYS_LOCALE Default fa
IRANIAN_HOLIDAYS_TIMEOUT HTTP timeout in seconds
IRANIAN_HOLIDAYS_FILL_QUEUE Queue name for fill job
IRANIAN_HOLIDAYS_PRUNE_QUEUE Queue name for prune job

Schema

Table iranian_holidays:

  • gregorian_date (unique) — write source of truth
  • jalali_date (Y-m-d, unique) — filled automatically from Gregorian on save

Only holiday days are stored; presence of a row means that day is an official holiday.

License

MIT