cmelda / holidays
Holidays and Name's day by country
Fund package maintenance!
Ko-Fi
v1.4
2025-01-06 07:24 UTC
Requires
- php: >=8.2
- ext-json: *
Requires (Dev)
- arxeiss/coding-standards: ^0.12
- codeception/codeception: ^5.1
- codeception/module-asserts: ^3
- phpstan/phpstan: ^2.0
- rector/rector: ^2.0
Suggests
- ext-calendar: *
README
Install
composer require cmelda/holidays
List of available countries
Usage
Public Holiday
$holidays = new \Cmelda\Holidays\Holidays('cze');
$date = new DateTimeImmutable();
$day = $holidays->getDay($date);
try {
$publicHolidays = $day->getPublicHoliday();
} catch (\Cmelda\Holidays\Exceptions\NoPublicHolidayException $e) {
// no public holiday
}
Name's day
$holidays = new \Cmelda\Holidays\Holidays('cze');
$date = new DateTimeImmutable();
$day = $holidays->getDay($date);
try {
$names = $day->getNames();
} catch (\Cmelda\Holidays\Exceptions\NoNameException $e) {
// no name's day
}
Day
$date = new DateTimeImmutable();
$day = new \Cmelda\Holidays\Day($date);
try {
$names = $day->getNames('cze');
} catch (\Cmelda\Holidays\Exceptions\NoNameException $e) {
// no name's day
}
try {
$names = $day->getNames('svk');
} catch (\Cmelda\Holidays\Exceptions\NoNameException $e) {
// no name's day
}
License
Distributed under the MIT License. See LICENSE.txt
for more information.