PHPackages                             silvesterk/business-days - 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. silvesterk/business-days

ActiveLibrary

silvesterk/business-days
========================

A simple helper class used for calculating business days

v2.0(2y ago)22.0k↓100%MITPHPPHP ^7.2||^8.0

Since Jul 3Pushed 2y ago1 watchersCompare

[ Source](https://github.com/silvesterk/business-days)[ Packagist](https://packagist.org/packages/silvesterk/business-days)[ RSS](/packages/silvesterk-business-days/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (1)Versions (7)Used By (0)

Business days
=============

[](#business-days)

A simple helper PHP library used for calculating business days,

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

[](#installation)

`composer require silvesterk/business-days`

Classes
-------

[](#classes)

### BusinessDays

[](#businessdays)

#### getBusinessDayNumberFromRange

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

[](#example)

```
$bizDays = new BusinessDays();
$dateRange = new DateRange('yesterday','today');
$businessDays = $bizDays->getBusinessDayNumberFromRange($dateRange);

```

#### isBusinessDay

[](#isbusinessday)

```
    /**
     * @param \DateTime $dateTime
     * @return bool
     */
    public function isBusinessDay(\DateTime $dateTime)

```

Returns true if the provided date is a business day.

##### Example

[](#example-1)

```
$isTodayABizDay = $bizDays->isBusinessDay(new \DateTime());

```

#### isWeekend

[](#isweekend)

```
    /**
     * @param \DateTime $dateTime
     * @return bool
     */
    public function isWeekend(\DateTime $dateTime)

```

Returns true if the provided date is a weekend day.

##### Example

[](#example-2)

```
$isItWeekend = $bizDays->isWeekend(new \DateTime());

```

#### isHoliday

[](#isholiday)

```
    /**
     * @param \DateTime $dateTime
     * @return bool
     */
    public function isHoliday(\DateTime $dateTime)

```

Returns true if the provided date is a holiday.

##### Example

[](#example-3)

```
$isItAHoliday = $bizDays->isHoliday(new \DateTime());

```

#### getHolidays

[](#getholidays)

Returns the list of holidays

#### addHoliday

[](#addholiday)

```
    /**
     * @param \DateTime $dateTime
     */
    public function addHoliday(\DateTime $dateTime)

```

Adds a holiday to the holiday list

##### Example

[](#example-4)

Add today as a holiday (the current instantiation of the class will not count today as a business day).

```
$bizDays->addHoliday(new \DateTime());

```

### DateRange

[](#daterange)

A simple helper class used for defining two date times (from, to)

###  Health Score

34

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 76.9% 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 ~497 days

Total

5

Last Release

829d ago

Major Versions

v1.1 → v2.02023-12-14

PHP version history (2 changes)v1.0PHP ^7.2

v2.0PHP ^7.2||^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/92d92734a8b9acb15991aac3419ee805346a6558d254573c378aac04bfffbdaa?d=identicon)[silvesterk](/maintainers/silvesterk)

---

Top Contributors

[![silvesterk](https://avatars.githubusercontent.com/u/12173921?v=4)](https://github.com/silvesterk "silvesterk (10 commits)")[![skokai](https://avatars.githubusercontent.com/u/227112596?v=4)](https://github.com/skokai "skokai (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/silvesterk-business-days/health.svg)

```
[![Health](https://phpackages.com/badges/silvesterk-business-days/health.svg)](https://phpackages.com/packages/silvesterk-business-days)
```

PHPackages © 2026

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