cline/opening-hours
Composer 安装命令:
composer require cline/opening-hours
包简介
A helper to query and format a set of opening hours
关键字:
README 文档
README
opening-hours
An immutable opening-hours engine built around typed schedules, date-specific override rules, and schema.org adapters.
Requirements
Requires PHP 8.5+
Installation
composer require cline/opening-hours
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
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.QueryOptionscontrols input timezone, output timezone, and search limits for transition queries.
Change log
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please use the GitHub security reporting form rather than the issue queue.
Credits
License
The MIT License. Please see License File for more information.
统计信息
- 总下载量: 2.59k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-06