PHPackages                             maxmeffert/feiertage - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. maxmeffert/feiertage

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

maxmeffert/feiertage
====================

A PHP7 utility for legal holidiays in Germany

v3.0.1(6y ago)16.1k↓60%[4 issues](https://github.com/maxmeffert/feiertage/issues)MITPHPPHP &gt;=7.2CI failing

Since Aug 10Pushed 4y ago1 watchersCompare

[ Source](https://github.com/maxmeffert/feiertage)[ Packagist](https://packagist.org/packages/maxmeffert/feiertage)[ Docs](http://maxmeffert.github.io/feiertage/)[ RSS](/packages/maxmeffert-feiertage/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (2)Versions (9)Used By (0)

[![Build Status](https://camo.githubusercontent.com/56f3b7dfb57a75e4c777fb02408912f1d2889bc68e536a1dc19cbc2d15a192a4/68747470733a2f2f7472617669732d63692e6f72672f6d61786d6566666572742f6665696572746167652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/maxmeffert/feiertage)[![Coverage Status](https://camo.githubusercontent.com/4b8061c6cdeb88d257e37b40c852ff570d4880ccc13fa5dd77a05a23a1defa0f/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d61786d6566666572742f6665696572746167652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/maxmeffert/feiertage?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/d8e4f01cc2ac779866603bc443a6b6fd6ee9860d22f077ad944eec262410e1a1/68747470733a2f2f706f7365722e707567782e6f72672f6d61786d6566666572742f6665696572746167652f762f737461626c65)](https://packagist.org/packages/maxmeffert/feiertage)[![License](https://camo.githubusercontent.com/c61796f09c7a3d431ce1f4164b5437741072887a380e51b728bd836c9bf7a860/68747470733a2f2f706f7365722e707567782e6f72672f6d61786d6566666572742f6665696572746167652f6c6963656e7365)](https://packagist.org/packages/maxmeffert/sabertooth)

[feiertage](http://intrawarez.github.io/feiertage/)
===================================================

[](#feiertage)

A PHP7 utility for **legal holidiays in Germany**.

- Computes all 19 legal holidays in Germany for a given year.
- Based on the **[Gaussian Easter Formula](https://de.wikipedia.org/wiki/Gau%C3%9Fsche_Osterformel)**
- Not limited to unix years, i.e. before 1970 or after 2037 (**does not rely on [`easter_date`](http://php.net/manual/en/function.easter-date.php)**).
- Tested for years: from 1700 to 2299.

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

[](#installation)

```
composer require maxmeffert/feiertage

```

Usage
-----

[](#usage)

### Get all holidays for specific year

[](#get-all-holidays-for-specific-year)

```
$ft = Feiertage::of(2020);
```

### Get a specific holliday

[](#get-a-specific-holliday)

```
$ft = Feiertage::of(2020);
$os = $ft[FeiertagEnum::OSTERSONNTAG];
```

### Check dates for holidays

[](#check-dates-for-holidays)

```
$date = new \DateTime(...);
if (Feiertage::check($date))
{
	...
}
```

or get the corresponding constant:

```
$date = new \DateTime(...);
$which = Feiertage::which($date);
if ($which == FeiertagEnum::OSTERSONNTAG)
{
	...
}
```

### Iterate over holidays

[](#iterate-over-holidays)

```
foreach (Feiertage::of(2020) as $holiday)
{
	...
}
```

Dynamic Holidays
----------------

[](#dynamic-holidays)

As for most western countries, all dynamic legal holidays in Germany are christian feasts, which are organized around **Easter Sunday**. That's why functions like [`easter_date`](http://php.net/manual/en/function.easter-date.php) exist. However [`easter_date`](http://php.net/manual/en/function.easter-date.php) is limited to unix years, i.e. before 1970 or after 2037. Instead of relying on [`easter_date`](http://php.net/manual/en/function.easter-date.php) this implementation is based on the *[Gaussian Easter Formula](https://de.wikipedia.org/wiki/Gau%C3%9Fsche_Osterformel)*, which is not limited to unix years. The *[Gaussian Easter Formula](https://de.wikipedia.org/wiki/Gau%C3%9Fsche_Osterformel)* computes Easter Sunday for a given year as a day of march, e.g. the 32th March is the 1st April, the 33rd March is the 2nd April, etc.

The implementation of the *[Gaussian Easter Formula](https://de.wikipedia.org/wiki/Gau%C3%9Fsche_Osterformel)* used by this library looks like this:

```
function div (int $a, int $b) : int {
	return intval( $a / $b );
}

function mod (int $a, int $b) : int {
	return intval( $a % $b );
}

function gauss (int $year) : int {
	$a = mod($year, 19);
	$b = mod($year, 4);
	$c = mod($year, 7);
	$H1 = div($year, 100);
	$H2 = div($year, 400);
	$N = 4 + $H1 - $H2;
	$M = 15 + $H1 - $H2 - div(8 * $H1 + 13, 25);
	$d = mod(19 * $a + $M, 30);
	$e = mod(2 * $b + 4 * $c + 6 * $d + $N, 7);
	$o = 22 + $d + $e;

	if ($o == 57) {
		$o = 50;
	}

	if ($d == 28 && $e == 6 && $a > 10) {
		$o = 49;
	}

	return $o;
}

function easterSunday (int $year) : \DateTimeImmutable {
	$day = gauss($year);

	$month = 3;

	if (31 < $os) {
		$day = mod($os, 31);
		$month = 4;
	}

	return new \DateTimeImmutable("{$year}-{$month}-{$day}");
}
```

Other reference implementations can be found here:

-
-
- [https://de.wikibooks.org/wiki/Algorithmensammlung:\_Kalender:\_Feiertage](https://de.wikibooks.org/wiki/Algorithmensammlung:_Kalender:_Feiertage)

License
-------

[](#license)

The MIT License (MIT)

Copyright (c) 2020 Maximilian Meffert

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~218 days

Recently: every ~327 days

Total

7

Last Release

2247d ago

Major Versions

v0.0.0 → v1.0.02016-08-10

v1.0.0 → v2.0.02016-08-11

v2.1.0 → v3.0.02020-03-14

PHP version history (3 changes)v0.0.0PHP &gt;=5.4

v2.0.0PHP &gt;=7

v3.0.0PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/75ce70b6f9d22d72a45085e232d4a6227bfb2cd5e95f9ad31b9a0ebe17ae9457?d=identicon)[mxmffrt](/maintainers/mxmffrt)

---

Top Contributors

[![maxmeffert](https://avatars.githubusercontent.com/u/2137323?v=4)](https://github.com/maxmeffert "maxmeffert (6 commits)")

---

Tags

dynamic-holidaysgaussian-easter-formulagermanyholidaysphpphp-libraryphp7

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/maxmeffert-feiertage/health.svg)

```
[![Health](https://phpackages.com/badges/maxmeffert-feiertage/health.svg)](https://phpackages.com/packages/maxmeffert-feiertage)
```

###  Alternatives

[andrefigueira/blog-article-faker

Generate random blog article titles and content (including markdown) using faker

1415.0k](/packages/andrefigueira-blog-article-faker)

PHPackages © 2026

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