Skip to content

Commit f8fb22c

Browse files
committed
Document holidays
1 parent 063e30d commit f8fb22c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

+20
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,26 @@ composer require mll-lab/php-utils
2020

2121
See [tests](tests).
2222

23+
### Holidays
24+
25+
You can add custom holidays by registering a method that returns a map of holidays for a given year.
26+
Set this up in a central place that always runs before your application, e.g. a bootstrap method.
27+
28+
```php
29+
use MLL\Holidays\BavarianHolidays;
30+
31+
BavarianHolidays::$loadUserDefinedHolidays = static function (int $year): array {
32+
switch ($year) {
33+
case 2019:
34+
return ['22.03' => 'Day of the Tentacle'];
35+
default:
36+
return [];
37+
}
38+
};
39+
```
40+
41+
Custom holidays have precedence over the holidays inherent to this library.
42+
2343
### PHPStan extension
2444

2545
This library provides a PHPStan extension that is either registered through [PHPStan Extension Installer](https://github.com/phpstan/extension-installer)

0 commit comments

Comments
 (0)