xddesigners / silverstripe-openinghours
Manage opening hours (with exceptions) for any DataObject in SilverStripe, backed by spatie/opening-hours.
Package info
github.com/xddesigners/silverstripe-openinghours
Type:silverstripe-vendormodule
pkg:composer/xddesigners/silverstripe-openinghours
Requires
- silverstripe/framework: ^6.0
- spatie/opening-hours: ^3.3
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-12 11:46:41 UTC
README
Manage opening hours (with exceptions) for any DataObject in SilverStripe, backed by
spatie/opening-hours.
SilverStripe 6 module. Extracted from the in-house Linberg (viva-basic) port so it can be
reused and maintained as a proper package. Replaces the abandoned bramdeleeuw/silverstripe-openinghours.
Requirements
- silverstripe/framework ^6.0
- spatie/opening-hours ^3.3
- PHP 8.3+
Installation
composer require xddesigners/silverstripe-openinghours
Usage
Apply an extension to the model that should have opening hours, then dev/build:
# app/_config/openinghours.yml Viva\Basic\Models\Store: extensions: - XD\OpeningHours\ExtendedOpeningHours
XD\OpeningHours\OpeningHours— base extension: adds theOpeningHour(per-weekday) andOpeningHourException(date-range) has_many relations, CMS GridFields, and helpers such asisOpen()/getOpeningHoursQuery()(aSpatie\OpeningHours\OpeningHoursinstance).XD\OpeningHours\ExtendedOpeningHours— addsOpeningHoursWithExceptions(), a per-weekdayArrayList(Days/From/Till/IsClosed/Reason) that already folds in exceptions, ready for templates.
Classes
| Class | Purpose |
|---|---|
OpeningHours |
Extension: relations, CMS fields, spatie query builder, open/closed helpers |
ExtendedOpeningHours |
Extension subclass: per-weekday list including exceptions |
OpeningHour |
DataObject: one weekday's time range |
OpeningHourException |
DataObject: a date-range exception (closed / different hours) |
GridFieldConfig_OpeningHours |
CMS GridField config for the weekly hours |
GridFieldConfig_OpeningHoursException |
CMS GridField config for exceptions |