PHPackages                             bauerdot/czech-library - 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. bauerdot/czech-library

ActiveLibrary

bauerdot/czech-library
======================

New library taking care of czech (svátky - státní svátky a jmeniny)

v0.0.2(1y ago)09PHPPHP &gt;=8.0

Since Apr 30Pushed 1y ago1 watchersCompare

[ Source](https://github.com/bauerDOTuzh/czech-library)[ Packagist](https://packagist.org/packages/bauerdot/czech-library)[ RSS](/packages/bauerdot-czech-library/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Czech Library
=============

[](#czech-library)

A PHP library for working with Czech name days and holidays, including support for movable holidays like Easter.

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

[](#installation)

```
composer require bauerdot/czech-library
```

Features
--------

[](#features)

- Get name days for a specific date
- Find when a specific name has its name day
- Check if a specific date is a Czech holiday (including movable holidays like Easter)
- Generate name day greetings
- Generate holiday announcements
- Support for localization
- Accurate Easter holiday calculations

Usage Examples
--------------

[](#usage-examples)

### Basic Usage

[](#basic-usage)

```
use Bauerdot\CzechLibrary\CzechLibraryFactory;

// Create the service
$czechService = CzechLibraryFactory::createCzechCelebrationService();

// Get today's name days
$today = new DateTime();
$nameDays = $czechService->getNameDaysForDate($today);

// Output example: ["Blahoslav"]
var_dump($nameDays);

// Generate a greeting
$greeting = $czechService->generateNameDayGreeting($today);
// Output example: "Dnes má svátek Blahoslav"
echo $greeting;

// Check if today is a holiday
$holiday = $czechService->getHolidayForDate($today);
if ($holiday) {
    // Output example: "Dnes je Svátek práce"
    echo $czechService->generateHolidayAnnouncement($today);
}

// Find when a specific name has its name day
$nameDate = $czechService->getDateForName('Karina');
echo $nameDate ? $nameDate->format('j.n.') : 'Name day not found'; // Output: "2.1."
```

### Working with Easter Holidays

[](#working-with-easter-holidays)

The library accurately handles Czech Easter holidays (Good Friday, Easter Sunday, and Easter Monday):

```
use Bauerdot\CzechLibrary\CzechLibraryFactory;

$czechService = CzechLibraryFactory::createCzechCelebrationService();

// Check Good Friday 2025 (April 18, 2025)
$goodFriday = new DateTime('2025-04-18');
echo $czechService->getHolidayForDate($goodFriday); // "Velký pátek"

// Check Easter Sunday 2025 (April 20, 2025)
$easterSunday = new DateTime('2025-04-20');
echo $czechService->getHolidayForDate($easterSunday); // "Velikonoční neděle"

// Check Easter Monday 2025 (April 21, 2025)
$easterMonday = new DateTime('2025-04-21');
echo $czechService->getHolidayForDate($easterMonday); // "Velikonoční pondělí"
```

### Custom Templates

[](#custom-templates)

```
use Bauerdot\CzechLibrary\CzechLibraryFactory;

$czechService = CzechLibraryFactory::createCzechCelebrationService();
$today = new DateTime();

// Custom templates
$nameGreeting = $czechService->generateNameDayGreeting($today, "Dnes slaví svátek {names}");
$holidayAnnouncement = $czechService->generateHolidayAnnouncement($today, "Dnes je státní svátek: {holiday}");

echo $nameGreeting;
echo $holidayAnnouncement;
```

### Multiple Names

[](#multiple-names)

The library handles dates with multiple names correctly:

```
use Bauerdot\CzechLibrary\CzechLibraryFactory;

$czechService = CzechLibraryFactory::createCzechCelebrationService();

// January 6 has three names: Kašpar, Melichar, Baltazar
$threeKings = new DateTime('2025-01-06');
$nameGreeting = $czechService->generateNameDayGreeting($threeKings);

echo $nameGreeting; // "Dnes má svátek Kašpar, Melichar a Baltazar"
```

### Combined Daily Greeting with Emojis

[](#combined-daily-greeting-with-emojis)

Get a combined greeting that includes both holiday and name day information, enhanced with emojis:

```
use Bauerdot\CzechLibrary\CzechLibraryFactory;

$czechService = CzechLibraryFactory::createCzechCelebrationService();

// Get the daily greeting for today
$today = new DateTime();
$dailyGreeting = $czechService->getDailyGreeting($today);
echo $dailyGreeting;
// Example output: "🎄 Dnes je Štědrý den a 🎂 svátek má Eva a Adam"

// Without emojis
$dailyGreetingNoEmojis = $czechService->getDailyGreeting($today, false);
echo $dailyGreetingNoEmojis;
// Example output: "Dnes je Štědrý den a svátek má Eva a Adam"
```

Interface
---------

[](#interface)

The library implements the following interfaces:

### CelebrationInterface

[](#celebrationinterface)

```
interface CelebrationInterface
{
    // Get all name days for a specific date
    public function getNameDaysForDate(\DateTimeInterface $date): array;

    // Find when a specific name has its name day
    public function getDateForName(string $name): ?\DateTimeInterface;

    // Check if a date is a holiday
    public function getHolidayForDate(\DateTimeInterface $date): ?string;

    // Generate name day greeting
    public function generateNameDayGreeting(\DateTimeInterface $date, string $template = null): string;

    // Generate holiday announcement
    public function generateHolidayAnnouncement(\DateTimeInterface $date, string $template = null): ?string;

    // Generate a complete daily greeting with both holiday and name day information with emojis
    public function getDailyGreeting(\DateTimeInterface $date, bool $includeEmojis = true): string;
}
```

### LocalizationInterface

[](#localizationinterface)

```
interface LocalizationInterface
{
    // Get locale code (e.g., 'cs')
    public function getLocaleCode(): string;

    // Get name day greeting template
    public function getNameDayTemplate(): string;

    // Get holiday announcement template
    public function getHolidayTemplate(): string;

    // Get combined daily greeting template with holiday and name day info
    public function getDailyGreetingTemplate(): string;

    // Get combined daily greeting template with emojis
    public function getDailyGreetingEmojiTemplate(): string;

    // Format multiple names for output
    public function formatNames(array $names): string;
}
```

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

License
-------

[](#license)

This library is licensed under the MIT License.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance49

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 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 ~6 days

Total

2

Last Release

377d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5ed5cf078b75e518346f8c1ef66e707252e17a5495c9678c29d800e2216f53cc?d=identicon)[bauerdot](/maintainers/bauerdot)

---

Top Contributors

[![bauerDOTuzh](https://avatars.githubusercontent.com/u/91192620?v=4)](https://github.com/bauerDOTuzh "bauerDOTuzh (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bauerdot-czech-library/health.svg)

```
[![Health](https://phpackages.com/badges/bauerdot-czech-library/health.svg)](https://phpackages.com/packages/bauerdot-czech-library)
```

PHPackages © 2026

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