A Laravel package for converting Gregorian dates to Sorani Kurdish calendar. This package provides an easy-to-use interface for working with Kurdish dates in your Laravel applications.
- ✅ Convert Gregorian dates to Sorani Kurdish calendar
- ✅ Get current date in Kurdish calendar
- ✅ Support for multiple date formats
- ✅ Helper functions for easy usage
- ✅ Facade support
- ✅ Configurable month and day names
- ✅ Laravel 10+ support
Once published to Packagist, you can install the package via composer:
composer require bryarghafoor/sorani-calendarFor local development, add this to your project's composer.json:
{
"repositories": [
{
"type": "path",
"url": "./packages/sorani-calendar"
}
],
"require": {
"bryarghafoor/sorani-calendar": "dev-main"
}
}Then run:
composer update bryarghafoor/sorani-calendarThe package will automatically register its service provider in Laravel 5.5+.
For older versions, add the service provider to config/app.php:
'providers' => [
// ...
BryarGhafoor\SoraniCalendar\SoraniCalendarServiceProvider::class,
],Add the facade to your config/app.php:
'aliases' => [
// ...
'SoraniCalendar' => BryarGhafoor\SoraniCalendar\Facades\SoraniCalendar::class,
],Publish the configuration file:
php artisan vendor:publish --tag=sorani-calendar-configuse BryarGhafoor\SoraniCalendar\Facades\SoraniCalendar;
// Get current date in Kurdish calendar
$today = SoraniCalendar::now();
// Returns: ['day' => 21, 'month' => 11, 'year' => 2726, 'monthName' => 'رێبهندان', 'dayName' => 'یهکشهممه']
// Convert specific date
$date = SoraniCalendar::convert('2024-03-21');
// or
$date = SoraniCalendar::convert(new DateTime('2024-03-21'));
// Format date
$formatted = SoraniCalendar::format($date, 'full');
// Returns: "یهکشهممه، 1 خاکهلێوه 2724"
$formatted = SoraniCalendar::format($date, 'date');
// Returns: "1 خاکهلێوه 2724"
$formatted = SoraniCalendar::format($date, 'short');
// Returns: "1/1/2724"
// Get month names
$months = SoraniCalendar::getMonthNames();
// Get day names
$days = SoraniCalendar::getDayNames();
// Check if year is leap year
$isLeap = SoraniCalendar::isLeapYear(2024);// Get current date
$today = sorani_now();
// Convert specific date
$date = sorani_calendar('2024-03-21');
// Format date
$formatted = sorani_format($date, 'full');
// Get month names
$months = sorani_month_names();
// Get day names
$days = sorani_day_names();{{-- Display current Kurdish date --}}
<p>ڕێکەوت: {{ sorani_format(sorani_now(), 'full') }}</p>
{{-- Display specific date --}}
@php
$kurdishDate = sorani_calendar($document->created_at);
@endphp
<p>{{ sorani_format($kurdishDate, 'date') }}</p>
{{-- Using with your template variables --}}
<div>
<p>ڕێکەوت : {{ $kurdishYear }} کوردی</p>
<p>{{ $kurdishDay }} {{ $kurdishMonth }}</p>
</div>Update your controller to pass Kurdish date data:
use BryarGhafoor\SoraniCalendar\Facades\SoraniCalendar;
class DocumentFlowController extends Controller
{
public function show($id)
{
$document = DocumentFlow::findOrFail($id);
// Convert current date to Kurdish
$kurdishDate = SoraniCalendar::now();
return view('components.document-flow.out-going-template', [
'document' => $document,
'kurdishYear' => $kurdishDate['year'],
'kurdishMonth' => $kurdishDate['monthName'],
'kurdishDay' => $kurdishDate['day'],
]);
}
}- خاکهلێوه (Khakelewah) - March-April
- گوڵان (Gulan) - April-May
- جۆزهردان (Jozerdan) - May-June
- پووشپهڕ (Pushper) - June-July
- گهلاوێژ (Gelawezh) - July-August
- خهرمانان (Khermanan) - August-September
- رهزبهر (Rezber) - September-October
- خهزهڵوهر (Khezelwer) - October-November
- سهرماوهز (Sermawez) - November-December
- بهفرانبار (Befranbar) - December-January
- رێبهندان (Rebendan) - January-February
- رهشهمێ (Resheme) - February-March
- یهکشهممه (Yekshamah) - Sunday
- دووشهممه (Dushamah) - Monday
- سێشەممه (Seshamah) - Tuesday
- چوارشهممه (Charshamah) - Wednesday
- پێنجشهممه (Penjshamah) - Thursday
- ههینی (Heini) - Friday
- شهممه (Shamah) - Saturday
composer testContributions are welcome! Please feel free to submit a Pull Request.
- Conversion algorithm based on rojcode/kurdishCalendars
- Package developed by Bryar Ghafoor
The MIT License (MIT). Please see License File for more information.
Please see CHANGELOG for more information on what has changed recently.
If you discover any security related issues, please email bryar@example.com instead of using the issue tracker.