alesteq / date-ja
PHP library for getting Japanese public holidays and calendar information.
v1.4.4
2021-01-19 12:04 UTC
Requires
- php: ^7.0
Requires (Dev)
- codeclimate/php-test-reporter: ^0.4.4
- phpunit/phpunit: 6.4.*
README
日本の暦と祝日・休日、及びカレンダーを取得するPHPライブラリです。
Features
- 指定した月の祝日と休日を取得
- 指定日の祝日判定
- 祝日の名称を取得
- 和暦、西暦、月日、曜日を取得
- 元号を取得
- 明治, 大正, 昭和, 平成, 令和
- 曜日を取得
- 日, 月, 火, 水, 木, 金, 土
- 旧暦月名を取得
- 睦月, 如月, 弥生, 卯月, 皐月, 水無月, 文月, 葉月, 長月, 神無月, 霜月, 師走
- 干支を取得
- 十干
- 甲, 乙, 丙, 丁, 戊, 己, 庚, 辛, 壬, 癸
- 十二支
- 子, 丑, 寅, 卯, 辰, 巳, 午, 未, 申, 酉, 戌, 亥
- 十干
- 指定月の第n X曜日(e.g. 第2月曜日)の日付を取得
- 月毎のカレンダーの日付情報を取得
- 営業日を取得
Installation
DateJaライブラリを使用するにあたり、composerによるパッケージのインストールを行います。
composer require alesteq/date-ja
Usage
はじめにautoload.phpを読み込み、ネームスペースを宣言します。
<?php require_once "vendor/autoload.php"; use Alesteq\DateJa\DateJa;
次にDateJaクラスのインスタンスを生成します。
$dateJa = new DateJa();
e.g. 指定日が祝日かどうか判定する場合
// 祝日の場合はTRUE、平日の場合はFALSE $holiday = $dateJa->isHoliday(2019, 5, 1); // TRUE
メソッドの詳細はリファレンスマニュアルへ
License
The MIT License (MIT) 2019 - Alesteq. Please have a look at the LICENSE for more details.