silvesterk/business-days
Composer 安装命令:
composer require silvesterk/business-days
包简介
A simple helper class used for calculating business days
README 文档
README
A simple helper PHP library used for calculating business days,
Installation
composer require silvesterk/business-days
Classes
BusinessDays
getBusinessDayNumberFromRange
/**
* @param DateRange $dateRange
* @return int
*/
public function getBusinessDayNumberFromRange(DateRange $dateRange)
Method that takes in a date range and returns the number of business or work days between those two dates (+1)
Example
$bizDays = new BusinessDays();
$dateRange = new DateRange('yesterday','today');
$businessDays = $bizDays->getBusinessDayNumberFromRange($dateRange);
isBusinessDay
/**
* @param \DateTime $dateTime
* @return bool
*/
public function isBusinessDay(\DateTime $dateTime)
Returns true if the provided date is a business day.
Example
$isTodayABizDay = $bizDays->isBusinessDay(new \DateTime());
isWeekend
/**
* @param \DateTime $dateTime
* @return bool
*/
public function isWeekend(\DateTime $dateTime)
Returns true if the provided date is a weekend day.
Example
$isItWeekend = $bizDays->isWeekend(new \DateTime());
isHoliday
/**
* @param \DateTime $dateTime
* @return bool
*/
public function isHoliday(\DateTime $dateTime)
Returns true if the provided date is a holiday.
Example
$isItAHoliday = $bizDays->isHoliday(new \DateTime());
getHolidays
Returns the list of holidays
addHoliday
/**
* @param \DateTime $dateTime
*/
public function addHoliday(\DateTime $dateTime)
Adds a holiday to the holiday list
Example
Add today as a holiday (the current instantiation of the class will not count today as a business day).
$bizDays->addHoliday(new \DateTime());
DateRange
A simple helper class used for defining two date times (from, to)
silvesterk/business-days 适用场景与选型建议
silvesterk/business-days 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.19k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2018 年 07 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 silvesterk/business-days 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 silvesterk/business-days 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.19k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-07-03