omegacode/german-workday-calculator
Composer 安装命令:
composer require omegacode/german-workday-calculator
包简介
This library adds a class to calculate german workdays, using the api from https://feiertage-api.de/.
README 文档
README
Description
This library adds a class to calculate workdays using the api from https://feiertage-api.de/."
Installation
Add omegacode/german-workday-calculator as a dependency in your composer.json.
Usage
<?php require_once __DIR__.'/vendor/autoload.php'; // Create an instance of the calculator and set the states for german holidays to Hessen. $calculator = new \OmegaCode\GermanWorkdayCalculator\WorkdayCalculator(); $calculator->setState(OmegaCode\GermanWorkdayCalculator\States::NATIONAL); // Check the info section for all possibilities. // Create some test date time objects. $testDate = \DateTime::createFromFormat('Y-m-d', '2018-05-07'); $testDateFrom = \DateTime::createFromFormat('Y-m-d', '2018-07-03'); $testDateTill = \DateTime::createFromFormat('Y-m-d', '2018-07-10'); try { $result1 = $calculator->calculateIncrementedDate( $testDate, 365, [ \OmegaCode\GermanWorkdayCalculator\WorkdayCalculator::IGNORE_SUNDAY, \OmegaCode\GermanWorkdayCalculator\WorkdayCalculator::IGNORE_SATURDAY, ] ); } catch (Exception $e) { echo '[ERROR]: '.$e->getMessage().PHP_EOL; } try { $result2 = $calculator->calculateByDateRange( $testDateFrom, $testDateTill, [ \OmegaCode\GermanWorkdayCalculator\WorkdayCalculator::IGNORE_SUNDAY, \OmegaCode\GermanWorkdayCalculator\WorkdayCalculator::IGNORE_SATURDAY, ] ); } catch (OmegaCode\GermanWorkdayCalculator\API\APIException $e) { echo '[ERROR]: '.$e->getMessage().PHP_EOL; } catch (Exception $e) { echo '[ERROR]: '.$e->getMessage().PHP_EOL; } echo $result1->format('Y-m-d').PHP_EOL; // 2019-10-14 echo $result2.PHP_EOL; // 6
Info
Possible states for the calculator:
- BW (Baden-Württemberg)
- BY (Bayern)
- BE (Berlin)
- BB (Brandenburg)
- HB (Bremen)
- HH (Hamburg)
- HE (Hessen)
- MV (Mecklenburg-Vorpommern)
- NI (Niedersachsen)
- NW (Nordrhein-Westfalen)
- RP (Rheinland Pfalz)
- SL (Saarland)
- SN (Sachsen)
- ST (Sachen-Anhalt)
- SH (Schleswig Holstein)
- TH (Thüringen)
- NATIONAL
Change path of cached api response files
<?php require_once __DIR__.'/vendor/autoload.php'; // Create an instance of the calculator and set the states for german holidays to Hessen. $calculator = new \OmegaCode\GermanWorkdayCalculator\WorkdayCalculator(); $calculator->setCachePath("/my/custom/cache/path"); // do stuff..
omegacode/german-workday-calculator 适用场景与选型建议
omegacode/german-workday-calculator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 113 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 05 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 omegacode/german-workday-calculator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 omegacode/german-workday-calculator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 113
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2018-05-03