This PHP package automatically generates holidays for a given year, considering both federal states and the country. It provides an easy-to-use interface to retrieve public holidays based on specific regions, ensuring accurate and up-to-date holiday information for all supported areas. Movable public holidays such as Easter Monday are calculated automatically using the PHP function
easter_date()
. Static public holidays are permanently stored.
use Ixnode\PhpPublicHoliday\PublicHoliday;
$year = 2024;
$country = 'DE';
$state = 'SN';
$locale = 'de';
$holiday = new PublicHoliday(year: $year, countryCode: $country, stateCode: $state, localeCode: $locale);
print_r($holiday->getHolidays());
// (array) [Ixnode\PhpPublicHoliday\PublicHolidayItem Object, ...]
// - (DateTimeImmutable) ->getDate()
// - (string) ->getName()
Code | Country | States | Support |
---|---|---|---|
AT |
Austria | Burgenland (B ), Carinthia (K ), Lower Austria (N ), Upper Austria (O ), Salzburg (S ), Styria (ST ), Tyrol (T ), Vorarlberg (V ), Vienna (W ) |
fully supported ✔️ |
CH |
Switzerland | Canton of Zurich (ZH ), Canton of Bern (BE ), Canton of Lucerne (LU ), Canton of Uri (UR ), Canton of Schwyz (SZ ), Canton of Obwalden (OW ), Canton of Nidwalden (NW ), Canton of Glarus (GL ), Canton of Zug (ZG ), Canton of Fribourg (FR ), Canton of Solothurn (SO ), Canton of Basel-Stadt (BS ), Canton of Basel-Landschaft (BL ), Canton of Schaffhausen (SH ), Canton of Appenzell Ausserrhoden (AR ), Canton of Appenzell Innerrhoden (AI ), Canton of St. Gallen (SG ), Canton of the Grisons (GR ), Canton of Aargau (AG ), Canton of Thurgau (TG ), Canton of Ticino (TI ), Canton of Vaud (VD ), Canton of Valais (VS ), Canton of Neuchâtel (NE ), Canton of Geneva (GE ), Canton of Jura (JU ) |
fully supported ✔️ |
DE |
Germany | Brandenburg (BB ), Berlin (BE ), Baden Württemberg (BW ), Bavaria (BY ), Bremen (HB ), Hesse (HE ), Hamburg (HH ), Mecklenburg-Western Pomerania (MV ), Lower Saxony (NI ), Nordrhein-Westfalen (NW ), Rhineland-Palatinate (RP ), Schleswig-Holstein (SH ), Saarland (SL ), Saxony (SN ), Sachsen-Anhalt (ST ), Thuringia (TH ) |
fully supported ✔️ |
Code | Language | Support |
---|---|---|
cz |
Czech | fully supported ✔️ |
de |
German | fully supported ✔️ |
en |
English | fully supported ✔️ |
es |
Spanish | fully supported ✔️ |
fr |
French | fully supported ✔️ |
hr |
Croatian | fully supported ✔️ |
it |
Italian | fully supported ✔️ |
pl |
Polish | fully supported ✔️ |
sv |
Swedish | fully supported ✔️ |
composer require ixnode/php-public-holiday
vendor/bin/php-public-holiday -V
php-public-holiday 1.0.0 (2024-11-23 15:08:05) - Björn Hempel <bjoern@hempel.li>
Used to quickly check the public holidays.
development mode:
bin/console ph DE SN --year=2024
or within your composer project:
vendor/bin/php-public-holiday ph DE SN --year=2024
Year: 2024
Country: DE (Deutschland)
State: SN (Sachsen)
Locale: de (Deutsch)
- 2024-01-01: Neujahr
- 2024-03-29: Karfreitag
- 2024-03-31: Ostersonntag
- 2024-04-01: Ostermontag
- 2024-05-01: Tag der Arbeit
- 2024-05-09: Christi Himmelfahrt
- 2024-05-19: Pfingstsonntag
- 2024-05-20: Pfingstmontag
- 2024-05-30: Fronleichnam
- 2024-10-03: Tag der deutschen Einheit
- 2024-10-31: Reformationstag
- 2024-11-20: Buß- und Bettag
- 2024-12-25: Erster Weihnachtsfeiertag
- 2024-12-26: Zweiter Weihnachtsfeiertag
Available options:
cz
de
(default)en
es
fr
hr
it
pl
sv
vendor/bin/php-public-holiday ph DE SN --year=2025 --locale=en --format=text
Year: 2025
Country: DE (Germany)
State: SN (Saxony)
Locale: en (English)
- 2025-01-01: New Year
- 2025-04-18: Good Friday
- 2025-04-20: Easter Sunday
- 2025-04-21: Easter Monday
- 2025-05-01: Labour Day
- 2025-05-29: Feast of the Ascension
- 2025-06-08: Whit Sunday
- 2025-06-09: Whit Monday
- 2025-06-19: Feast of Corpus Christi
- 2025-10-03: German Unity Day
- 2025-10-31: Reformation Day
- 2025-11-19: Buß- und Bettag
- 2025-12-25: Christmas Day
- 2025-12-26: Boxing Day
vendor/bin/php-public-holiday ph AT K --year=2025 --locale=sv --format=text
Year: 2025
Country: AT (Österrike)
State: K (Kärnten)
Locale: sv (Svenska)
- 2025-01-01: Nyår (39 days)
- 2025-01-06: Tre vise männen (44 days)
- 2025-04-20: Påskdagen (147 days)
- 2025-04-21: Annandag påsk (148 days)
- 2025-05-01: Bankdagar (159 days)
- 2025-05-29: Kristi himmelsfärdsdag (186 days)
- 2025-06-08: Pingst (196 days)
- 2025-06-09: Annandag pingst (197 days)
- 2025-06-19: Corpus Christi (207 days)
- 2025-08-15: Jungfru Marie himmelsfärd (265 days)
- 2025-10-26: Nationaldag (337 days)
- 2025-11-01: Alla helgons dag (343 days)
- 2025-12-08: Obefläckade avlelsen (380 days)
- 2025-12-25: Jul (397 days)
- 2025-12-26: Stefani dag (398 days)
Available options:
text
(default)json
csv
vendor/bin/php-public-holiday ph DE SN --year=2025 --format=json
{
"country": "DE",
"state": "SN",
"year": 2025,
"locale": "de",
"holidays": [
{
"date": "2025-01-01",
"name": "Neujahr"
},
...
]
}
vendor/bin/php-public-holiday ph DE SN --year=2025 --format=csv
date;"public holiday"
2025-01-01;Neujahr
2025-04-18;Karfreitag
...
git clone git@github.com:ixnode/php-public-holiday.git && cd php-public-holiday
composer install
composer test
This library is licensed under the MIT License - see the LICENSE file for details.
- Björn Hempel bjoern@hempel.li
- https://www.hempel.li/