PHPackages                             fastbolt/working-day-provider - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. fastbolt/working-day-provider

ActiveLibrary

fastbolt/working-day-provider
=============================

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

v1.0.0(3y ago)0150MITPHPPHP ^7.4|^8.0|^8.1

Since Apr 13Pushed 3y ago1 watchersCompare

[ Source](https://github.com/fastbolt/working-day-provider)[ Packagist](https://packagist.org/packages/fastbolt/working-day-provider)[ Docs](https://github.com/fastbolt/working-day-provider)[ RSS](/packages/fastbolt-working-day-provider/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (11)Versions (3)Used By (0)

[![Composer version](https://camo.githubusercontent.com/d0e6f117ee65bb57d7e958ecca8983c890bc61971c95fb57baf6d4609b604e85/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f66617374626f6c742f776f726b696e672d6461792d70726f7669646572)](https://packagist.org/packages/fastbolt/working-day-provider)

[![Code Climate maintainability](https://camo.githubusercontent.com/a6d3e3d7c95ce71b757df77d9ce5966a38121f52af22649a3546370769a730cf/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636c696d6174652f6d61696e7461696e6162696c6974792f66617374626f6c742f776f726b696e672d6461792d70726f7669646572)](https://codeclimate.com/github/fastbolt/working-day-provider)[![Test Coverage](https://camo.githubusercontent.com/8d431db1a3253781267c63acd26b0ce0c1c50be29370c0fd81aa11996c85156d/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f66617374626f6c742f776f726b696e672d6461792d70726f7669646572)](https://app.codecov.io/gh/fastbolt/working-day-provider/)

[![Type Coverage](https://camo.githubusercontent.com/31c40016a459378cb953b558dcdfe814dfc0937b0dc952040e0327e235fd637c/68747470733a2f2f73686570686572642e6465762f6769746875622f66617374626f6c742f776f726b696e672d6461792d70726f76696465722f636f7665726167652e737667)](https://shepherd.dev/github/fastbolt/working-day-provider)[![Psalm Level](https://camo.githubusercontent.com/31996c958c8bfa6a6576ea7b496ea81bfdda9e51cde082fc7af84f5bb9609404/68747470733a2f2f73686570686572642e6465762f6769746875622f66617374626f6c742f776f726b696e672d6461792d70726f76696465722f6c6576656c2e737667)](https://shepherd.dev/github/fastbolt/working-day-provider)

[![Github Build](https://camo.githubusercontent.com/c65fcb4fd5c900c878af13291c74e8d9e0a5d0175754d96f8c3a56bf49b95d22/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f66617374626f6c742f776f726b696e672d6461792d70726f76696465722f706870756e69742e79616d6c3f6272616e63683d6d61696e)](https://github.com/fastbolt/working-day-provider/actions)

Working day provider
====================

[](#working-day-provider)

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

Prerequisites
-------------

[](#prerequisites)

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

Installation
------------

[](#installation)

The library can be installed via composer:

```
composer require fastbolt/working-day-provider

```

Usage
-----

[](#usage)

### Basic 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

[](#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)

[](#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)
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

1130d ago

Major Versions

v0.1.0 → v1.0.02023-04-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/d04d2a04687b8ad9bdde03c59ce18b5e627eee453efbc9a526ec6bc84a943c87?d=identicon)[dhirtzbruch](/maintainers/dhirtzbruch)

---

Top Contributors

[![dhirtzbruch](https://avatars.githubusercontent.com/u/426308?v=4)](https://github.com/dhirtzbruch "dhirtzbruch (13 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/fastbolt-working-day-provider/health.svg)

```
[![Health](https://phpackages.com/badges/fastbolt-working-day-provider/health.svg)](https://phpackages.com/packages/fastbolt-working-day-provider)
```

###  Alternatives

[phpdocumentor/reflection-docblock

With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.

9.4k722.2M1.2k](/packages/phpdocumentor-reflection-docblock)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[infection/infection

Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.

2.2k26.2M1.8k](/packages/infection-infection)[mailgun/mailgun-php

The Mailgun SDK provides methods for all API functions.

1.1k28.9M168](/packages/mailgun-mailgun-php)[driftingly/rector-laravel

Rector upgrades rules for Laravel Framework

1.2k12.0M462](/packages/driftingly-rector-laravel)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
