topaz/holidays

获取谷歌日历的公共假期

v1.01 2021-08-16 23:32 UTC

This package is auto-updated.

Last update: 2024-09-18 03:42:54 UTC


README

此包使用谷歌日历API来获取公共假期。数据总是包含三年的数据;去年、今年和明年。

如何使用

示例用法

<?php
require_once 'vendor/autoload.php';

use LazHoliday\PublicHoliday;

try {
    $holiday = new PublicHoliday();
    var_dump($holiday->fetch('usa')->getDataForYear(2021));
} catch (Exception $e) {
    var_dump($e->getMessage());
}

可用方法

  • fetch(string $country): PublicHoliday - 当传入国家时获取所有日历数据
  • getData(): array - 返回三年日历数据的一些信息
  • getItems(): array - 返回三年的日历数据
  • getDataForYear(int $year): array - 通过年份过滤假日数据
  • getSummary(): array - 获取假日的总结和日期

国家代码

https://gist.github.com/seanblanchfield/4df78d73c85b149133615c7953894076

许可证

本项目使用MIT许可证,欢迎贡献。