Search by

beziworld / laravel-polish-calendar

kamcw

Polish public holidays and business day calculations for Laravel: Carbon macros, validation rules and a facade.

Package info

github.com/Beziworld/laravel-polish-calendar

Homepage

Issues

pkg:composer/beziworld/laravel-polish-calendar

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

v1.0.0 2026-11-04 13:35 UTC

This package is auto-updated.

Last update: 2026-11-04 16:36:39 UTC


README

tests Latest Version License

Polish public holidays and business day arithmetic for Laravel: a facade, Carbon macros and a validation rule. Up to date with the 2025 amendment that made Christmas Eve (24 December) a public holiday.

Polska wersja dokumentacji

Installation

composer require beziworld/laravel-polish-calendar
php artisan vendor:publish --tag=polish-calendar-config   # optional

Usage

use Beziworld\PolishCalendar\Facades\PolishCalendar;

PolishCalendar::isHoliday('2026-12-24');                  // true (Wigilia, since 2025)
PolishCalendar::holiday('2026-06-04')?->name;             // "Boże Ciało"
PolishCalendar::isBusinessDay(now());
PolishCalendar::nextBusinessDay('2026-12-23');            // 2026-12-28
PolishCalendar::addBusinessDays('2026-04-30', 5);         // 2026-05-08
PolishCalendar::businessDaysBetween('2026-12-01', '2026-12-31'); // 21
PolishCalendar::holidays(2026);                           // list<Holiday> with key, name, englishName, date
PolishCalendar::saturdayHolidays(2026);                   // holidays on Saturday: an extra day off is due (art. 130 § 2 KP)
PolishCalendar::easter(2027);

Carbon macros

now()->isPolishHoliday();
now()->isPolishBusinessDay();
now()->addPolishBusinessDays(3);   // keeps the time of day and time zone
now()->subPolishBusinessDays(1);

Validation

$request->validate([
    'delivery_date' => ['required', 'date', 'after:today', 'pl_business_day'],
]);

// or as an object
use Beziworld\PolishCalendar\Rules\BusinessDay;
'delivery_date' => ['required', new BusinessDay()],

Configuration

POLISH_CALENDAR_DAYS_OFF=2026-12-31,2026-11-10   # company days off (bridge days, days granted for Saturday holidays)
POLISH_CALENDAR_SATURDAY_BUSINESS_DAY=false      # true for businesses working on Saturdays

Usage examples

Payment due date: 14 business days

$invoice->due_date = now()->addPolishBusinessDays(14)->toDateString();

Delivery estimate in the shop

$shipsOn = PolishCalendar::addBusinessDays(now()->hour < 14 ? today() : today()->addDay(), 0);
$deliveredOn = PolishCalendar::addBusinessDays($shipsOn, 1);

return "Delivery on {$deliveredOn->locale('pl')->isoFormat('dddd, D MMMM')}";

Do not send reminders on days off

Schedule::command('reminders:send')->dailyAt('09:00')->when(fn () => now()->isPolishBusinessDay());

Working time for a month (HR, payroll)

$hours = PolishCalendar::businessDaysBetween('2026-12-01', '2026-12-31') * 8
    - count(array_filter(PolishCalendar::saturdayHolidays(2026), fn ($h) => $h->date->month === 12)) * 8;

Holidays

New Year, Epiphany (since 2011), Easter Sunday and Monday, 1 May, 3 May, Pentecost, Corpus Christi, Assumption, All Saints' Day, Independence Day, Christmas Eve (since 2025), Christmas and the Second Day of Christmas. Easter is computed with the Meeus/Jones/Butcher algorithm; years 1990-2999 are supported.

Development

composer install
composer ci   # pint --test, phpstan (level 8), pest

Author

Created and maintained by Kamil Ćwiertnia, beziworld.eu.

Need a custom Laravel project? Get in touch through beziworld.eu.

Other packages by the author

laravel-polish-validation · laravel-company-data · laravel-nbp · laravel-przelewy24 · laravel-tpay · laravel-smsapi · laravel-directadmin

License

MIT. See LICENSE.md.