PHPackages                             qadir/pashto-calendar - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. qadir/pashto-calendar

ActiveLibrary[Localization &amp; i18n](/categories/localization)

qadir/pashto-calendar
=====================

A Laravel package for Pashto Solar Hijri calendar with localization and RTL support

10BladeCI passing

Since Jun 18Pushed 1w agoCompare

[ Source](https://github.com/Abdulqadir1234/Pashto-calendar)[ Packagist](https://packagist.org/packages/qadir/pashto-calendar)[ RSS](/packages/qadir-pashto-calendar/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Pashto Calendar for Laravel
===========================

[](#pashto-calendar-for-laravel)

[![Tests](https://github.com/Abdulqadir1234/Pashto-calendar/actions/workflows/tests.yml/badge.svg)](https://github.com/Abdulqadir1234/Pashto-calendar/actions/workflows/tests.yml)[![Latest Version on Packagist](https://camo.githubusercontent.com/9a75469eaeeeef4054c63c9e24a2c9438e399641b065df2547e7b889addb973d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f71616469722f70617368746f2d63616c656e6461722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/qadir/pashto-calendar)[![Total Downloads](https://camo.githubusercontent.com/4214a3c1723fca74d6d3cf6edc6006a2fe1d6e982d325239f0923c50e2d683a8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f71616469722f70617368746f2d63616c656e6461722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/qadir/pashto-calendar)[![License](https://camo.githubusercontent.com/2be8d1c2d5211db5d549c9426d9b24242ec2feb3ebaad714f6d328dbac93d71f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f416264756c7161646972313233342f50617368746f2d63616c656e6461723f7374796c653d666c61742d737175617265)](LICENSE.md)[![Laravel 10+](https://camo.githubusercontent.com/ef42137a084ea4260a0468ebba9e13704a042c3aa519fc965662092975f0ea2f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31302532422d4646324432303f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c)](https://laravel.com)

A comprehensive Laravel package for the **Pashto Solar Hijri (Shamsi) calendar** system used throughout Afghanistan. Includes bidirectional date conversion, event management, prayer times, interactive calendar UI, and full RTL/Pashto localization support.

Screenshots
-----------

[](#screenshots)

  **Calendar — Dark Mode** **Calendar — Light Mode**   [![](docs/screenshots/calendar-dark.png)](docs/screenshots/calendar-dark.png) [![](docs/screenshots/calendar-light.png)](docs/screenshots/calendar-light.png)   **Date Converter** **Year View**   [![](docs/screenshots/converter.png)](docs/screenshots/converter.png) [![](docs/screenshots/year-view.png)](docs/screenshots/year-view.png)   **Prayer Times** **Event Modal**   [![](docs/screenshots/prayer-times.png)](docs/screenshots/prayer-times.png) [![](docs/screenshots/event-modal.png)](docs/screenshots/event-modal.png) Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
    - [Basic Date Operations](#basic-date-operations)
    - [Event Management](#event-management)
    - [Prayer Times](#prayer-times)
    - [Blade Components](#blade-components)
    - [Blade Directives](#blade-directives)
    - [Carbon Macros](#carbon-macros)
    - [Helper Functions](#helper-functions)
    - [Validation Rules](#validation-rules)
    - [Eloquent Cast](#eloquent-cast)
    - [iCal Export](#ical-export)
- [Demo](#demo)
- [Multi-Language Support](#multi-language-support)
- [Artisan Commands](#artisan-commands)
- [Testing](#testing)
- [Contributing](#contributing)
- [License](#license)
- [Credits](#credits)

Features
--------

[](#features)

- **🔄 Bidirectional Date Conversion** — Convert seamlessly between Gregorian and Pashto (Jalali) calendars
- **📅 Event Management** — Create, update, and delete events with full recurrence support (daily, weekly, monthly, yearly)
- **🕌 Prayer Times** — Accurate prayer times for all 34 Afghan provinces using Muslim World League method with Hanafi Asr
- **🏆 Holiday System** — 30+ built-in Afghan national holidays with Artisan refresh command
- **📥 iCal Export** — Export events to Google Calendar, Outlook, and Apple Calendar formats
- **⚙️ Interactive Calendar UI** — AJAX-powered calendar with Alpine.js and Tailwind CSS
- **🌍 Multi-Language Support** — Pashto, Dari, and English with automatic RTL layout
- **🌙 Dark/Light Mode** — Theme persistence with localStorage
- **🎨 Blade Components** — Pre-built components: ``, ``, ``
- **✨ Blade Directives** — Convenient directives: `@pashtoDate`, `@pashtoNow`, `@pashtoNumber`, `@ifHoliday`
- **🔗 Carbon Macros** — Fluent API: `now()->toPashto()`, `Carbon::parsePashto()`
- **🛠️ Helper Functions** — `pashto_now()`, `pashto_number()`, `to_shamsi_pashto()`, and more
- **✅ Validation Rules** — `pashto_date`, `pashto_date_format`, `before_pashto_date`, `after_pashto_date`
- **💾 Eloquent Cast** — `PashtoDateCast` for automatic model attribute conversion
- **⚙️ Fully Configurable** — Language, numerals, RTL direction, week start, and more
- **🧪 Comprehensive Test Suite** — Pest tests with GitHub Actions CI/CD

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Laravel 10.0 or higher
- SQLite, MySQL, PostgreSQL, or other supported database

Installation
------------

[](#installation)

### 1. Install via Composer

[](#1-install-via-composer)

```
composer require qadirnasrat/pashto-calendar
```

Publish Configuration &amp; Assets:

```
php artisan vendor:publish --provider="Qadir\PashtoCalendar\PashtoCalendarServiceProvider"
php artisan migrate
```

This publishes:

- Configuration file: `config/pashto-calendar.php`
- Database migrations
- Language files: `lang/ps/`, `lang/fa/`, `lang/en/`
- View components

Run Migrations:

```
php artisan migrate
```

(Optional) Seed Holidays:

```
php artisan pashto:refresh-holidays
```

Configuration
-------------

[](#configuration)

```
return [
    // Default language: 'ps' (Pashto), 'fa' (Dari), 'en' (English)
    'language' => env('PASHTO_CALENDAR_LANGUAGE', 'ps'),

    // Display RTL: auto-detected based on language, or force true/false
    'rtl' => true,

    // Use Pashto numerals (۰۱۲۳...) or Western (0123...)
    'use_pashto_numbers' => true,

    // First day of week: 0 = Sunday, 6 = Saturday
    'first_day_of_week' => 6, // Saturday (Afghanistan standard)

    // Demo route path
    'demo_route' => '/pashto-calendar',

    // Enable demo route
    'enable_demo_route' => true,

    // Database table prefix
    'table_prefix' => 'pashto_',
];
```

Usage
-----

[](#usage)

### Basic Date Operations

[](#basic-date-operations)

#### Get Current Pashto Date

[](#get-current-pashto-date)

```
use Qadir\PashtoCalendar\Facades\PashtoCalendar;

$today = PashtoCalendar::now();

echo $today->year;        // 1405
echo $today->month;       // 3
echo $today->day;         // 23
echo $today->monthName(); // "غویی" (Pashto month name)
echo $today->dayName();   // "یکشنبه" (Sunday in Pashto)
```

#### Convert Gregorian to Pashto

[](#convert-gregorian-to-pashto)

```
$pashto = PashtoCalendar::fromGregorian('2024-03-20');

echo $pashto->format('Y/m/d');     // "1403/01/01"
echo $pashto->format('Y-m-d H:i'); // "1403-01-01 00:00"
```

#### Convert Pashto to Gregorian

[](#convert-pashto-to-gregorian)

```
$gregorian = PashtoCalendar::toGregorian(1403, 1, 1);
// Returns: Carbon instance for 2024-03-20

echo to_gregorian(1403, 1, 1); // "2024-03-20"
```

#### Generate Calendar Grid

[](#generate-calendar-grid)

```
$days = PashtoCalendar::make(1405, 3); // Year 1405, Month 3

foreach ($days as $day) {
    if ($day['empty']) continue; // Skip empty cells

    echo $day['day'];           // Day number
    echo $day['is_today'];      // Is today?
    echo $day['is_friday'];     // Is Friday?
    echo $day['is_holiday'];    // Is holiday?
    echo $day['holiday_name'];  // Holiday name if applicable
    echo $day['events'];        // Associated events array
}
```

### Event Management

[](#event-management)

#### Create Event

[](#create-event)

```
use Qadir\PashtoCalendar\Events\EventManager;

$event = EventManager::add([
    'title'                => 'Team Meeting',
    'description'          => 'Quarterly planning',
    'year'                 => 1405,
    'month'                => 3,
    'day'                  => 15,
    'time'                 => '10:00',
    'color'                => '#3b82f6',
    'recurrence'           => 'weekly', // 'none', 'daily', 'weekly', 'monthly', 'yearly'
    'recurrence_end_date'  => '1405-06-15',
]);
```

#### Retrieve Events

[](#retrieve-events)

```
// Events for specific date
$events = EventManager::forDate(1405, 3, 15);

// Events for entire month
$events = EventManager::forMonth(1405, 3);

// Today's events
$events = EventManager::today();

// All events
$events = EventManager::all();
```

#### Update Event

[](#update-event)

```
EventManager::update($eventId, [
    'title'  => 'Updated Meeting',
    'time'   => '14:00',
    'color'  => '#ef4444',
]);
```

#### Delete Event

[](#delete-event)

```
EventManager::delete($eventId);

// Clear all events for a month
EventManager::clearMonth(1405, 3);
```

### Prayer Times

[](#prayer-times)

#### Prayer Times Component

[](#prayer-times-component)

```

```

Available cities: Kabul, Kandahar, Herat, Mazar-i-Sharif, Jalalabad, Kunduz, Bamyan, Badakhshan, Baghlan, Balkh, Daykundi, Faryab, Farah, Ghazni, Ghor, Hilmand, Jawzjan, Kapisa, Kunar, Lagman, Logar, Nangarhar, Nimruz, Nurestan, Paktia, Paktika, Panshir, Parwan, Samangan, Saripul, Takhar, Urozgan, Wardak, Zabul. API Endpoint

GET /pashto-calendar/prayer-times/{city}

**Response:**

```
{
  "city": "kabul",
  "city_name": "کابل",
  "latitude": 34.5553,
  "longitude": 69.2075,
  "fajr": "02:47 AM",
  "sunrise": "04:37 AM",
  "dhuhr": "11:55 AM",
  "asr": "03:45 PM",
  "maghrib": "07:14 PM",
  "isha": "09:04 PM"
}
```

### Blade Components

[](#blade-components)

#### Full Calendar

[](#full-calendar)

```

```

#### Mini Calendar

[](#mini-calendar)

```

```

#### Prayer Times

[](#prayer-times-1)

```

```

### Blade Directives

[](#blade-directives)

#### Display Pashto Date

[](#display-pashto-date)

```
{{-- Display Pashto Date --}}
@pashtoDate($post->created_at)

{{-- Display Current Pashto Date --}}
@pashtoNow

{{-- Convert Number to Pashto --}}
@pashtoNumber(1405)

{{-- Holiday Conditional --}}
@ifHoliday(1, 1)
    🎉 Happy Nowroz! (Afghan New Year)
@endIfHoliday
```

### Carbon Macros

[](#carbon-macros)

```
use Illuminate\Support\Carbon;

// Convert Carbon to Pashto
$pashtoDate = now()->toPashto();
echo $pashtoDate->year; // 1405

// Parse Pashto date to Carbon
$carbon = Carbon::parsePashto(1405, 3, 23);
echo $carbon->format('Y-m-d'); // 2026-06-14

// Check if Pashto holiday
if (now()->isPashtoHoliday()) {
    echo "Today is a holiday!";
}
```

### Helper Functions

[](#helper-functions)

```
// Get current Pashto date
$today = pashto_now();
echo $today->year; // 1405

// Convert number to Pashto numerals
$pashtoNum = pashto_number(1405);
echo $pashtoNum; // ۱۴۰۵

// Convert Gregorian to Pashto
$shamsi = to_shamsi_pashto(2024, 3, 20);
echo $shamsi; // "۱۴۰۳/۰۱/۰۱"

// Convert Pashto to Gregorian
$gregorian = to_gregorian(1403, 1, 1);
echo $gregorian; // "2024-03-20"

// Get Pashto month name
$month = pashto_month_name(3);
echo $month; // "غویی"

// Get Pashto day name
$day = pashto_day_name(0); // 0 = Sunday
echo $day; // "یکشنبه"
```

### Validation Rules

[](#validation-rules)

```
$request->validate([
    'birth_date' => 'required|pashto_date',
    'event_date' => 'required|pashto_date_format:Y/m/d',
    'start_date' => 'required|before_pashto_date:1406/12/29',
    'end_date'   => 'required|after_pashto_date:1403/01/01',
]);
```

### Eloquent Cast

[](#eloquent-cast)

```
use Qadir\PashtoCalendar\Casts\PashtoDateCast;
use Illuminate\Database\Eloquent\Model;

class Event extends Model
{
    protected $casts = [
        'event_date' => PashtoDateCast::class,
    ];
}

// Usage
$event = Event::find(1);
echo $event->event_date->year;  // 1405
echo $event->event_date->month; // 3
```

### iCal Export

[](#ical-export)

Export events to .ics format for Google Calendar, Outlook, and Apple Calendar

```

    📥 Export to Calendar

```

Or via API: GET /pashto-calendar/export/{year}/{month}.ics

Demo
----

[](#demo)

Visit the interactive calendar demo at:

The demo includes: ✨ Full interactive calendar with month navigation 📅 Event creation, editing, and deletion 🕌 Real-time prayer times 🌙 Dark/Light mode toggle 🌍 Multi-language support 📱 Fully responsive design Disable demo route in config/pashto-calendar.php:

'enable\_demo\_route' =&gt; false,

Multi-Language Support
----------------------

[](#multi-language-support)

The package supports Pashto (ps), Dari (fa), and English (en). Set Application Language In config/app.php:

```
'locale' => 'ps', // or 'fa', 'en'
```

Or dynamically:

```
App::setLocale('ps');
```

### Publish Language Files:

[](#publish-language-files)

```
php artisan vendor:publish --tag=pashto-calendar-lang
```

Artisan Commands
----------------

[](#artisan-commands)

Refresh Holidays Update holiday database from configuration: Refresh for current year Refresh for specific year

```
php artisan pashto:refresh-holidays

php artisan pashto:refresh-holidays 1406

php artisan pashto:refresh-holidays --year=1405-1410
```

Testing
-------

[](#testing)

```
composer test
composer test tests/Unit/PashtoCalendarTest.php
composer test -- --coverage
```

Contributing
------------

[](#contributing)

We welcome contributions! Please read CONTRIBUTING.md for guidelines.

License
-------

[](#license)

This package is licensed under the MIT License. See LICENSE.md for details.

Credits
-------

[](#credits)

- Author: Abdul Qadir Nasrat
- Contributors: See CONTRIBUTORS.md
- Inspired by: Laravel ecosystem best practices and Hijri Calendar implementations

###  Health Score

21

—

LowBetter than 17% of packages

Maintenance64

Regular maintenance activity

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/211700242?v=4)[Abdul Qadir Nasrat](/maintainers/Abdulqadir1234)[@Abdulqadir1234](https://github.com/Abdulqadir1234)

---

Top Contributors

[![Abdulqadir1234](https://avatars.githubusercontent.com/u/211700242?v=4)](https://github.com/Abdulqadir1234 "Abdulqadir1234 (100 commits)")

### Embed Badge

![Health badge](/badges/qadir-pashto-calendar/health.svg)

```
[![Health](https://phpackages.com/badges/qadir-pashto-calendar/health.svg)](https://phpackages.com/packages/qadir-pashto-calendar)
```

###  Alternatives

[smarty-gettext/smarty-gettext

Gettext plugin enabling internationalization in Smarty Package files

752.5M8](/packages/smarty-gettext-smarty-gettext)[symfony/ux-translator

Exposes Symfony Translations directly to JavaScript.

26779.7k9](/packages/symfony-ux-translator)[mageplaza/magento-2-italian-language-pack

Italian language package for Magento 2

161.4M](/packages/mageplaza-magento-2-italian-language-pack)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
