承接 fastbolt/working-day-provider 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

fastbolt/working-day-provider

Composer 安装命令:

composer require fastbolt/working-day-provider

包简介

PHP package to ease calculation of number of working days between two dates.

README 文档

README

Composer version

Code Climate maintainability Test Coverage

Type Coverage Psalm Level

Github Build

Working day provider

PHP package to ease calculation of number of working days between two given dates.

Prerequisites

For now, the bundle is tested using PHP 7.4, 8.0 and 8.1.

Installation

The library can be installed via composer:

composer require fastbolt/working-day-provider

Usage

Basic usage

For the most basic usage, you can use the WorkingDayProvider without any configuration.

By default, it will not use any application or region specific holiday, but only consider monday to friday as working days.

use Fastbolt\WorkingDayProvider\WorkingDayProvider;

$workingDayProvider = new WorkingDayProvider();
$workingDays = $workingDayProvider->getWorkingDaysForPeriod(
    new DateTimeImmutable('2023-01-01'),
    new DateTimeImmutable('2023-01-07')
);

// $workingDays will be 5

Application / region specific holidays

The library is designed to include application / region specific holidays as "non-working days".

To do so, you need to create a class implementing the Fastbolt\WorkingDayProvider\Holiday\HolidayProvider interface.

The only interface method getHolidaysForDateRange must return an array of objects implementing the \Fastbolt\WorkingDayProvider\Holiday\Holiday interface.

use Acme\Provider\HolidayProvider;
use Fastbolt\WorkingDayProvider\WorkingDayProvider;

$holidayProvider = new HolidayProvider());

# Example `$holidayProvider->getHolidaysForDateRange(2022-12-24, 2022-12-26)` returns one holiday for 26th of december.
$workingDayProvider = new WorkingDayProvider($holidayProvider);
$workingDays = $workingDayProvider->getWorkingDaysForPeriod(
    new DateTimeImmutable('2022-12-24'),
    new DateTimeImmutable('2022-12-26')
);

// $workingDays will be 0 (days are saturday, sunday and holiday)

Custom configuration (not yet fully-implemented)

Optionally, you can provide a custom configuration to the WorkingDayProvider constructor.

use Fastbolt\WorkingDayProvider\Configuration;
use Fastbolt\WorkingDayProvider\WorkingDayProvider;

$configuration = new Configuration(['excludeWeekDays' => [1, 6, 7]);
$workingDayProvider = new WorkingDayProvider(null, $configuration);
$workingDays = $workingDayProvider->getWorkingDaysForPeriod(
    new DateTimeImmutable('2022-12-24'),
    new DateTimeImmutable('2022-12-26')
);

// $workingDays will be 0 (working days monday, saturday and sunday are all configured as non-working days)

fastbolt/working-day-provider 适用场景与选型建议

fastbolt/working-day-provider 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 156 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 04 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 fastbolt/working-day-provider 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 156
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 18
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-04-13