PHPackages                             cline/opening-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. cline/opening-hours

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

cline/opening-hours
===================

A helper to query and format a set of opening hours

2.0.3(1mo ago)0199—0%MITPHPPHP ^8.5.0CI passing

Since Mar 6Pushed 1mo agoCompare

[ Source](https://github.com/faustbrian/opening-hours)[ Packagist](https://packagist.org/packages/cline/opening-hours)[ RSS](/packages/cline-opening-hours/feed)WikiDiscussions 2.x Synced 1mo ago

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

[![GitHub Workflow Status](https://github.com/faustbrian/opening-hours/actions/workflows/quality-assurance.yaml/badge.svg)](https://github.com/faustbrian/opening-hours/actions)[![Latest Version on Packagist](https://camo.githubusercontent.com/872f4969d56ffaa22d15f796bf3c698d857e8d210123a75a10b7519aaa093054/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636c696e652f6f70656e696e672d686f7572732e737667)](https://packagist.org/packages/cline/opening-hours)[![Software License](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/cac08ad87f76bdc6148f0d6a75255b0351bd6d1f112a6a7f8b37d97ee0fa8aad/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636c696e652f6f70656e696e672d686f7572732e737667)](https://packagist.org/packages/cline/opening-hours)

---

opening-hours
=============

[](#opening-hours)

An immutable opening-hours engine built around typed schedules, date-specific override rules, and schema.org adapters.

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

[](#requirements)

> **Requires [PHP 8.5+](https://php.net/releases/)**

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

[](#installation)

```
composer require cline/opening-hours
```

Usage
-----

[](#usage)

```
use Cline\OpeningHours\OpeningHours;
use Cline\OpeningHours\QueryOptions;

$openingHours = OpeningHours::fromArray([
    'monday' => ['09:00-17:00'],
    'tuesday' => ['09:00-17:00'],
    'exceptions' => [
        '2026-12-24' => [],
        '2026-12-31 to 2027-01-02' => ['10:00-14:00'],
        '01-01' => [],
    ],
], new QueryOptions(
    timezone: 'Europe/Helsinki',
));

$openingHours->isOpenAt(new DateTimeImmutable('2026-03-09 10:00:00'));
$openingHours->nextOpen(new DateTimeImmutable('2026-03-09 18:00:00'));
$openingHours->asStructuredData();
```

V2 API
------

[](#v2-api)

- `OpeningHours::fromArray()` builds schedules from weekday definitions plus explicit exception rules.
- `OpeningHours::fromWeeklySchedule()` builds directly from typed value objects.
- `OpeningHours::createFromStructuredData()` imports schema.org opening hour specifications.
- `QueryOptions` controls input timezone, output timezone, and search limits for transition queries.

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please use the [GitHub security reporting form](https://github.com/faustbrian/opening-hours/security) rather than the issue queue.

Credits
-------

[](#credits)

- [Brian Faust](https://github.com/faustbrian)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License. Please see [License File](LICENSE.md) for more information.

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance96

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity55

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 ~2 days

Total

7

Last Release

51d ago

Major Versions

1.x-dev → 2.0.02026-03-06

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/22145591?v=4)[Brian Faust](/maintainers/faustbrian)[@faustbrian](https://github.com/faustbrian)

---

Top Contributors

[![faustbrian](https://avatars.githubusercontent.com/u/22145591?v=4)](https://github.com/faustbrian "faustbrian (6 commits)")

---

Tags

php

### Embed Badge

![Health badge](/badges/cline-opening-hours/health.svg)

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

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21421.6k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

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