PHPackages                             encoredigitalgroup/business-hours - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. encoredigitalgroup/business-hours

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

encoredigitalgroup/business-hours
=================================

v0.1.2(8mo ago)13.4k↓46.2%BSD-3-ClausePHPPHP ^8.3CI failing

Since Aug 13Pushed 8mo agoCompare

[ Source](https://github.com/EncoreDigitalGroup/php-business-hours)[ Packagist](https://packagist.org/packages/encoredigitalgroup/business-hours)[ RSS](/packages/encoredigitalgroup-business-hours/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (15)Versions (4)Used By (0)

Business Hours
==============

[](#business-hours)

Business Hours is a PHP library that provides a type-safe wrapper around [spatie/opening-hours](https://github.com/spatie/opening-hours)and [cmixin/business-day](https://github.com/kylekatarnls/business-day). It allows you to manage business hours, holidays, and exceptions in a robust, object-oriented way.

Features
--------

[](#features)

- Type-safe configuration of business hours for each day of the week
- Support for holidays and exceptions
- Integration with Spatie OpeningHours and BusinessDay for advanced time calculations

Requirements
------------

[](#requirements)

- PHP 8.3 or higher

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

[](#installation)

Install via Composer:

```
composer require encoredigitalgroup/business-hours
```

Usage
-----

[](#usage)

### Basic Setup

[](#basic-setup)

```
use EncoreDigitalGroup\BusinessHours\BusinessHours;

$config = BusinessHours::config();
```

### Configuring Business Hours

[](#configuring-business-hours)

Below is an example of how to set business hours and how to set exceptions to those business hours.

```
use EncoreDigitalGroup\StdLib\Objects\Calendar\DayOfWeek;
use Carbon\Carbon; #You can also use Illuminate\Support\Carbon

// Set Monday hours
$config->day(DayOfWeek::Monday)->addHours("09:00", "17:00");

// Set exceptions
$config->exceptions()->adjustedHours(Carbon::parse("2025-07-04"), "08:00", "14:00:", "4th of July");
$config->exceptions()->closed(Carbon::parse("2025-12-25"), "Christmas Day");
```

### Adding Holidays

[](#adding-holidays)

Below is an example of how to create and configure a holiday. When creating the holiday, the library will automatically register the date as a closed exception.

```
use Carbon\Carbon;

$config->holidays()->region("global")->add(Carbon::parse("2025-12-25"), "christmas", "Christmas Day", true);
```

### Checking If a Date Is a Holiday

[](#checking-if-a-date-is-a-holiday)

```
use Carbon\Carbon;

Carbon::parse("2025-12-25")->isHoliday(); // true
```

Testing
-------

[](#testing)

This project uses [PestPHP](https://pestphp.com/) for testing. To run the test suite:

```
vendor/bin/pest
```

Contributing
------------

[](#contributing)

Contributions are welcome! Please submit pull requests and ensure all tests pass.

License
-------

[](#license)

License information can be found in the [LICENSE.md](LICENSE.md) file.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance62

Regular maintenance activity

Popularity24

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90% 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 ~18 days

Total

3

Last Release

242d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0c78c232b40f1006e496164f8cdbf70e91f945b5962b0d13aae14d076fda21e6?d=identicon)[onairmarc](/maintainers/onairmarc)

---

Top Contributors

[![onairmarc](https://avatars.githubusercontent.com/u/50760632?v=4)](https://github.com/onairmarc "onairmarc (9 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/encoredigitalgroup-business-hours/health.svg)

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

20917.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9346.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

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