PHPackages                             sakai/jp-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. sakai/jp-holiday

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

sakai/jp-holiday
================

Japanese national holidays library for PHP

v1.0.1(3mo ago)00MITPHPPHP &gt;=7.1

Since Jan 8Pushed 3mo agoCompare

[ Source](https://github.com/sakai/jp-holiday-php)[ Packagist](https://packagist.org/packages/sakai/jp-holiday)[ RSS](/packages/sakai-jp-holiday/feed)WikiDiscussions main Synced 1mo ago

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

jp-holiday
==========

[](#jp-holiday)

[English](#english) | [日本語](#%E6%97%A5%E6%9C%AC%E8%AA%9E)

---

English
-------

[](#english)

Japanese national holidays library for PHP.

Verified against the [National Astronomical Observatory of Japan (NAO)](https://eco.mtk.nao.ac.jp/koyomi/) official data.

### Requirements

[](#requirements)

- PHP 7.1+

### Installation

[](#installation)

```
composer require sakai/jp-holiday
```

### Usage

[](#usage)

```
use Sakai\JpHoliday\JpHoliday;

$date = new DateTimeImmutable('2024-01-01');

JpHoliday::isHoliday($date);     // true
JpHoliday::getName($date);       // '元日'
JpHoliday::getNameEn($date);     // "New Year's Day"
JpHoliday::getDescription($date); // '年のはじめを祝う。'
```

#### Get Full Holiday Info

[](#get-full-holiday-info)

```
$info = JpHoliday::getHolidayInfo($date);
// ['name' => '元日', 'name_en' => "New Year's Day", 'description' => '...']
```

#### Get All Holidays in a Year

[](#get-all-holidays-in-a-year)

```
$holidays = JpHoliday::getHolidaysInYear(2024);
// ['2024-01-01' => [...], '2024-01-08' => [...], ...]
```

#### Get Holidays in Date Range

[](#get-holidays-in-date-range)

```
$holidays = JpHoliday::between(
    new DateTimeImmutable('2024-04-01'),
    new DateTimeImmutable('2024-05-31')
);
```

#### DateTime / DateTimeImmutable / Carbon

[](#datetime--datetimeimmutable--carbon)

Any class implementing `DateTimeInterface` is supported.

### API

[](#api)

MethodReturnsDescription`isHoliday($date)``bool`Whether the date is a holiday`getName($date)``?string`Holiday name in Japanese`getNameEn($date)``?string`Holiday name in English`getDescription($date)``?string`Holiday description in Japanese`getHolidayInfo($date)``?array`Full holiday info array`getHolidaysInYear($year)``array`All holidays in a year`between($start, $end)``array`Holidays within date range### Configuration

[](#configuration)

Limit date ranges for `between()` to prevent DoS:

```
JpHoliday::configure(['maxBetweenDays' => 365]);  // Limit to 365 days
JpHoliday::getConfig();                            // ['maxBetweenDays' => 365]
JpHoliday::resetConfig();                          // Reset to default (no limit)
```

### Supported Holidays

[](#supported-holidays)

- Fixed holidays (New Year's Day, National Foundation Day, etc.)
- Happy Monday holidays (Coming of Age Day, Marine Day, etc.)
- Equinox days (Vernal/Autumnal Equinox Day)
- Substitute holidays (振替休日)
- Citizen's holidays (国民の休日)
- Special: 2019 Imperial transition, 2020/2021 Olympics

### Limitations

[](#limitations)

This library only supports dates from **July 20, 1948** onwards, when the [National Holidays Act](https://laws.e-gov.go.jp/law/323AC1000000178) (国民の祝日に関する法律) was enacted. Dates before this will return empty/null.

### Data Sources &amp; Maintenance

[](#data-sources--maintenance)

Equinox dates (Vernal Equinox Day, Autumnal Equinox Day) are hardcoded based on official announcements from the National Astronomical Observatory of Japan. The dates are published in the "Reki-yoko" (暦要項) around February 1st each year for the following year.

**References:**

- [国立天文台 暦要項](https://eco.mtk.nao.ac.jp/koyomi/yoko/) - Official equinox dates
- [国立天文台 FAQ](https://www.nao.ac.jp/faq/a0301.html) - About equinox calculation
- [祝日の計算方法](http://www.asahi-net.or.jp/~ci5m-nmr/misc/holiday.html) - Reference for historical data

**Note:** This library requires annual updates to add new equinox dates. Please check for updates or contribute if you notice missing data.

### License

[](#license)

MIT

---

日本語
---

[](#日本語)

日本の祝日を判定するPHPライブラリ

[国立天文台 暦要項](https://eco.mtk.nao.ac.jp/koyomi/)の公式データで検証済み。

### 必要環境

[](#必要環境)

- PHP 7.1以上

### インストール

[](#インストール)

```
composer require sakai/jp-holiday
```

### 使い方

[](#使い方)

```
use Sakai\JpHoliday\JpHoliday;

$date = new DateTimeImmutable('2024-01-01');

JpHoliday::isHoliday($date);     // true
JpHoliday::getName($date);       // '元日'
JpHoliday::getNameEn($date);     // "New Year's Day"
JpHoliday::getDescription($date); // '年のはじめを祝う。'
```

#### 祝日情報をまとめて取得

[](#祝日情報をまとめて取得)

```
$info = JpHoliday::getHolidayInfo($date);
// ['name' => '元日', 'name_en' => "New Year's Day", 'description' => '...']
```

#### 1年分の祝日を取得

[](#1年分の祝日を取得)

```
$holidays = JpHoliday::getHolidaysInYear(2024);
// ['2024-01-01' => [...], '2024-01-08' => [...], ...]
```

#### 期間内の祝日を取得

[](#期間内の祝日を取得)

```
$holidays = JpHoliday::between(
    new DateTimeImmutable('2024-04-01'),
    new DateTimeImmutable('2024-05-31')
);
```

#### DateTime / DateTimeImmutable / Carbon 対応

[](#datetime--datetimeimmutable--carbon-対応)

`DateTimeInterface` を実装していればどの日付クラスでも使用可能。

### API

[](#api-1)

メソッド戻り値説明`isHoliday($date)``bool`祝日かどうか`getName($date)``?string`祝日名（日本語）`getNameEn($date)``?string`祝日名（英語）`getDescription($date)``?string`祝日の説明`getHolidayInfo($date)``?array`祝日情報配列`getHolidaysInYear($year)``array`1年分の祝日`between($start, $end)``array`期間内の祝日### グローバル設定

[](#グローバル設定)

`between()` の日数制限でDoS対策:

```
JpHoliday::configure(['maxBetweenDays' => 365]);  // 最大365日に制限
JpHoliday::getConfig();                            // ['maxBetweenDays' => 365]
JpHoliday::resetConfig();                          // デフォルトにリセット（無制限）
```

### 対応する祝日

[](#対応する祝日)

- 固定祝日（元日、建国記念の日など）
- ハッピーマンデー（成人の日、海の日など）
- 春分の日・秋分の日
- 振替休日
- 国民の休日
- 特例: 2019年皇位継承、2020/2021年オリンピック

### 制限事項

[](#制限事項)

このライブラリは[国民の祝日に関する法律](https://laws.e-gov.go.jp/law/323AC1000000178)が施行された**1948年7月20日以降**の日付のみ対応しています。それ以前の日付は空/nullを返します。

### データソース・メンテナンス

[](#データソースメンテナンス)

春分の日・秋分の日は、国立天文台の公式発表に基づきハードコードしています。日付は毎年2月1日頃に翌年分が「暦要項」で発表されます。

**参照:**

- [国立天文台 暦要項](https://eco.mtk.nao.ac.jp/koyomi/yoko/) - 春分・秋分の公式日付
- [国立天文台 FAQ](https://www.nao.ac.jp/faq/a0301.html) - 春分・秋分の計算について
- [祝日の計算方法](http://www.asahi-net.or.jp/~ci5m-nmr/misc/holiday.html) - 過去のデータの参照元

**注意:** このライブラリは毎年の更新が必要です。データの不足に気づいた場合は、更新の確認またはコントリビュートをお願いします。

### ライセンス

[](#ライセンス)

MIT

---

Author / 作者
-----------

[](#author--作者)

Kiyoshi Sakai

Related / 関連
------------

[](#related--関連)

- [jp-holiday](https://github.com/sakai/jp-holiday-js) - JavaScript/TypeScript version / JS/TS版

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance82

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity30

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

Total

2

Last Release

97d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7216ecad48d28daa8e8a54f3840e862d8427e9e5ad087b928225191541a66233?d=identicon)[sakai](/maintainers/sakai)

---

Top Contributors

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

---

Tags

calendarholidayjapanjapanese

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sakai-jp-holiday/health.svg)

```
[![Health](https://phpackages.com/badges/sakai-jp-holiday/health.svg)](https://phpackages.com/packages/sakai-jp-holiday)
```

###  Alternatives

[holidayapi/holidayapi-php

Official PHP library for Holiday API

35213.3k1](/packages/holidayapi-holidayapi-php)[org_heigl/holidaychecker

Check for holidays - localeaware

843.4k](/packages/org-heigl-holidaychecker)[moe/full-calendar

A lightweight calendar module for Silverstripe. Implements the popular javascript http://fullcalendar.io/ library.

121.5k](/packages/moe-full-calendar)

PHPackages © 2026

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