PHPackages                             hostlink/hk-public-holiday - 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. hostlink/hk-public-holiday

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

hostlink/hk-public-holiday
==========================

1.0.1(1y ago)07MITPHPPHP &gt;=8.0.0

Since Dec 12Pushed 1y ago1 watchersCompare

[ Source](https://github.com/HostLink/hk-public-holiday)[ Packagist](https://packagist.org/packages/hostlink/hk-public-holiday)[ RSS](/packages/hostlink-hk-public-holiday/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

HK Public Holiday
=================

[](#hk-public-holiday)

This library provides functionality to check Hong Kong public holidays and manage holiday data caching.

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

[](#installation)

To install the library, use Composer:

```
composer require hostlink/hk-public-holiday
```

Usage
-----

[](#usage)

### Initialization

[](#initialization)

To initialize the `Holiday` class, you can specify the language (`en`, `tc`, `sc`) and an optional cache instance.

```
use HostLink\Calendar\Holiday;

//en: English, tc: Traditional Chinese, sc: Simplified Chinese
$holiday = new Holiday("en");
```

### Methods

[](#methods)

#### `clearCache()`

[](#clearcache)

Clears the cached holiday data.

```
$holiday->clearCache();
```

#### `getData()`

[](#getdata)

Fetches the holiday data. If the data is not cached, it will download it from the internet and cache it for one month.

```
$data = $holiday->getData();
```

#### `isHoliday(string $date): bool`

[](#isholidaystring-date-bool)

Checks if a given date is a holiday.

```
$isHoliday = $holiday->isHoliday("2023-12-25");
```

#### `getRange(string $from, string $to)`

[](#getrangestring-from-string-to)

Gets the holidays within a specified date range.

```
$holidays = $holiday->getRange("2023-01-01", "2023-12-31");
```

### Example

[](#example)

```
use HostLink\Calendar\Holiday;

$holiday = new Holiday("en");

// Check if a specific date is a holiday
if ($holiday->isHoliday("2023-12-25")) {
    echo "It's a holiday!";
} else {
    echo "It's not a holiday.";
}

// Get holidays within a date range
$holidays = $holiday->getRange("2023-01-01", "2023-12-31");
foreach ($holidays as $holiday) {
    echo $holiday["date"] . ": " . $holiday["name"] . "\n";
}
```

License
-------

[](#license)

This project is licensed under the MIT License.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance44

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

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

Total

2

Last Release

486d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/30f25555e58060ace793b731c172c739d45e9506154c9611990d2f985f61652b?d=identicon)[mathsgod](/maintainers/mathsgod)

---

Top Contributors

[![mathsgod](https://avatars.githubusercontent.com/u/18732337?v=4)](https://github.com/mathsgod "mathsgod (7 commits)")

### Embed Badge

![Health badge](/badges/hostlink-hk-public-holiday/health.svg)

```
[![Health](https://phpackages.com/badges/hostlink-hk-public-holiday/health.svg)](https://phpackages.com/packages/hostlink-hk-public-holiday)
```

###  Alternatives

[fisharebest/webtrees

webtrees online genealogy

73710.5k12](/packages/fisharebest-webtrees)

PHPackages © 2026

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