定制 azuyalabs/yasumi 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

azuyalabs/yasumi

Composer 安装命令:

composer require azuyalabs/yasumi

包简介

The easy PHP Library for calculating holidays

README 文档

README

GitHub Release Total Downloads Coding Standard Static analysis Testing Software License

Logo

Introduction

Yasumi (Japanese for 'Holiday'「休み」) is the easy PHP library that helps you retrieve the dates and names of holidays and other special celebrations from various countries/states. It is calculation and rule driven avoiding the need of a comprehensive database.

Many services exist that can provide holiday information, however are either not entirely free or only offer limited information. In addition, no exhaustive PHP library exists today covering a wide range of holidays and countries. PEAR's Date_Holidays library was a similar attempt, however it hasn't been updated for a long time.

Requirements

Yasumi requires PHP 8.2 or higher. The library supports PHP 8.2, 8.3, 8.4, and 8.5.

For detailed information about supported PHP versions and security updates, please refer to the SECURITY.md file.

Installation

Install Yasumi using Composer:

composer require azuyalabs/yasumi

Quick Start

Here's a simple example to get you started:

<?php

require 'vendor/autoload.php';

// Create a holiday provider for a specific country and year
$holidays = Yasumi\Yasumi::create('USA', 2026);

// Get all holidays for the year
foreach ($holidays as $holiday) {
    echo $holiday->getName() . ': ' . $holiday->format('Y-m-d') . PHP_EOL;
}

// Get a specific holiday
$independenceDay = $holidays->getHoliday('independenceDay');
echo $independenceDay->getName() . ' is on ' . $independenceDay->format('F j, Y') . PHP_EOL;

// Check if a date is a holiday
$newYearsDay = $holidays->getHoliday('newYearsDay');
if ($newYearsDay !== null) {
    echo 'New Year\'s Day is a holiday!' . PHP_EOL;
}

For more examples, check the examples directory in the repository.

Highlights

The goal of Yasumi is to be powerful while remaining lightweight, by utilizing PHP native classes wherever possible. Yasumi's calculation is provider-based (i.e. by country/state), making it easy to add new holiday providers that calculate holidays.

  • Pure PHP with a straightforward API
  • Framework-agnostic
  • Use of Providers to easily extend and expand new Holidays
  • Common Holiday Providers (e.g. Christian Holidays)
  • Accounts for the date/time when holidays have been officially established and/or abolished
  • Filters enabling to easily select certain holiday types (Official, Observed, Bank, Seasonal or Other)
  • Global Translations
  • Time zone aware
  • Implements ArrayIterator to easily process a provider's holidays
  • Fully documented
  • Fully unit tested
  • Composer ready, PSR-12 and PSR-4 compliant

Documentation

Yasumi’s documentation is available on https://www.yasumi.dev. You will find all the necessary information how to install Yasumi and also recipes how you can use Yasumi in your project.

Contributing

Contributions are encouraged and welcome; I am always happy to get feedback or pull requests on GitHub :) Create GitHub Issues for bugs and new features and comment on the ones you are interested in.

If you enjoy what I am making, an extra cup of coffee is very much appreciated :). Your support helps me to put more time into Open-Source Software projects like this.

Buy Me A Coffee

License

This project is open-sourced software licensed under the MIT License (MIT). Please see LICENSE for more information.

azuyalabs/yasumi 适用场景与选型建议

azuyalabs/yasumi 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12.67M 次下载、GitHub Stars 达 1.09k, 最近一次更新时间为 2015 年 03 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「time」 「date」 「calendar」 「calculation」 「Bank」 「holiday」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 azuyalabs/yasumi 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 azuyalabs/yasumi 我们能提供哪些服务?
定制开发 / 二次开发

基于 azuyalabs/yasumi 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 12.67M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1094
  • 点击次数: 26
  • 依赖项目数: 24
  • 推荐数: 0

GitHub 信息

  • Stars: 1090
  • Watchers: 14
  • Forks: 167
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-24