NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist
Packagist, #1706 most downloaded on Packagist
A helper to query and format a set of opening hours
Latest stable
4.2.3
Last release 1 months ago
27 Sep 2026
Release timing varies
gaps range from 9 days to 1.1 years
Nearly every release is documented
notes for 57 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
10 years old
63 releases · first in 2016
Drag across the ruler to compare, or tap a release to open it.
Report a 24:00 close on the next midnight by @SashaMIT in https://github.com/spatie/opening-hours/pull/283
Full Changelog: https://github.com/spatie/opening-hours/compare/4.2.2...4.2.3
Fix Time comparison to ignore metadata and date context by @Amunak in https://github.com/spatie/opening-hours/pull/281
Time::isSameOrBefore()Full Changelog: https://github.com/spatie/opening-hours/compare/4.2.1...4.2.2
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Time::isSameOrBefore()Time::isBefore() and Time::isAfter() comparing metadata and date context instead of clock time onlyFix previousClose with custom timezone by @kylekatarnls in https://github.com/spatie/opening-hours/pull/276
Full Changelog: https://github.com/spatie/opening-hours/compare/4.2.0...4.2.1
Merge time ranges takes in to account the data field, by @jhorie in https://github.com/spatie/opening-hours/pull/269
Full Changelog: https://github.com/spatie/opening-hours/compare/4.1.3...4.2.0
Allow 'dateTimeClass' in mergeOverlappingRanges and createAndMerge* by @kylekatarnls in https://github.com/spatie/opening-hours/pull/267
Full Changelog: https://github.com/spatie/opening-hours/compare/4.1.2...4.1.3
Update implicit nullable by @michaelw85 in https://github.com/spatie/opening-hours/pull/265
Full Changelog: https://github.com/spatie/opening-hours/compare/4.1.1...4.1.2
Update implicit nullable by @michaelw85 in https://github.com/spatie/opening-hours/pull/264
Full Changelog: https://github.com/spatie/opening-hours/compare/4.1.0...4.1.1
Fix isAlwaysClosed and isAlwaysOpen when opening hours contain exceptions by @jordyvanderhaegen in https://github.com/spatie/opening-hours/pull/262
isAlwaysClosed and isAlwaysOpen when opening hours contain exceptions by @jordyvanderhaegen in https://github.com/spatie/opening-hours/pull/262Full Changelog: https://github.com/spatie/opening-hours/compare/4.0.3...4.1.0
Fix nextClose() result with overflow over night by @kylekatarnls in https://github.com/spatie/opening-hours/pull/259
nextClose() result with overflow over night by @kylekatarnls in https://github.com/spatie/opening-hours/pull/259Full Changelog: https://github.com/spatie/opening-hours/compare/4.0.2...4.0.3
Handle opening-time with the first minute of day only by @kylekatarnls in https://github.com/spatie/opening-hours/pull/256
Full Changelog: https://github.com/spatie/opening-hours/compare/4.0.1...4.0.2
Allow date without year in validFrom/validTo structured data
Full Changelog: https://github.com/spatie/opening-hours/compare/4.0.0...4.0.1
Replace getData() with readonly property ->data
getData() with readonly property ->dataisAlwaysOpen() and isAlwaysClosed() methodsDay to an enumTime and TimeRange readonlyOpeningHours by @ambroisemaupate in https://github.com/spatie/opening-hours/pull/232createFromStructuredData() by @kylekatarnls in https://github.com/spatie/opening-hours/pull/237Full Changelog: https://github.com/spatie/opening-hours/compare/3.0.0...4.0.0
getData() with readonly property ->dataisAlwaysOpen() and isAlwaysClosed() methodsDay to an enumTime and TimeRange readonlyOpeningHourscreateFromStructuredData()Add ranges support via to or - separator
Time::date() methodDateTimeRange classto or - separatorfill() and setData()setFilters()Cap holidays check to end date when calculating diff
Cap holidays check to end date when calculating diff
Make comparison microsecond-precise
Make comparison microsecond-precise
Apply timezone for all methods and both input/output
Apply timezone for all methods and both input/output
Copy non immutable dates to apply timezone
Copy non immutable dates to apply timezone
Add array-shape create() PHPDoc
Add array-shape create() PHPDoc
- Fix compatibility with PHP 8.1
Add dateTimeClass option to use other class for date objects
Add dateTimeClass option to use other class for date objects
mergeOverlappingRanges now properly handle hours for each hour or encapsulating a list of hours.
mergeOverlappingRanges now properly handle hours for each hour or encapsulating a list of hours.
mergeOverlappingRanges now handles "hours" key and clean "data" keys before merging ranges
mergeOverlappingRanges now handles "hours" key and clean "data" keys before merging ranges
Use OpeningHours timezone for isOpenOn()
Allow isOpenOn() to take date string as parameter
Allow isOpenOn() to take date string as parameter
Add new methods: - diffInOpenHours - diffInOpenMinutes - diffInOpenSeconds - diffInClosedHours - diffInClosedMinutes - diffInClosedSeconds
Fix support of data/filters/overflow with OpeningHours::createAndMergeOverlappingRanges and OpeningHours::mergeOverlappingRanges
Fix support of data/filters/overflow with OpeningHours::createAndMergeOverlappingRanges and OpeningHours::mergeOverlappingRanges
Add InvalidTimezone exception
Add InvalidTimezone exception
Add forWeekConsecutiveDays method
Add forWeekConsecutiveDays method
Add new methods: - previousOpen - previousClose - currentOpenRange - currentOpenRangeStart - currentOpenRangeEnd
Add new methods:
previousOpen()previousClose()currentOpenRange()currentOpenRangeStart()currentOpenRangeEnd()- Allowed #128 un-ordered ranges
#121 Allow to pass timezone in TimeRange::format
#121 Allow to pass timezone in TimeRange::format
#121 Allow custom format and timezone in asStructuredData()
#121 Allow custom format and timezone in asStructuredData()
Fix merge when last range of day ends with 24:00
Fix merge when last range of day ends with 24:00
Fix #115 return 24:00 when Time::fromString('24:00') is casted to string
Fix #115 return 24:00 when Time::fromString('24:00') is casted to string
Add a MaximumLimitExceeded exception to prevent infinite loop
Add a MaximumLimitExceeded exception to prevent infinite loop
TimeRange no longer return true on containsTime for times overflowing next day Overflow is now calculated at the day level (OpeningHoursForDay) New me
TimeRange no longer return true on containsTime for times overflowing next day Overflow is now calculated at the day level (OpeningHoursForDay) New methods:
OpeningHoursForDay::isOpenAtNight TimeRange::overflowsNextDay
⚠ TimeRange no longer return true on containsTime for times overflowing next day. Overflow is now calculated at the day level (OpeningHoursForDay).
OpeningHoursForDay::isOpenAtNight()TimeRange::overflowsNextDay()Fix #111 overflow with simple ranges and add tests
Fix #111 overflow with simple ranges and add tests
Allow opening hours overflowing on the next day by passing 'overflow' => true option in array definition
Allow opening hours overflowing on the next day by passing 'overflow' => true option in array definition
Fix #98 Set precise time bounds
Fix #98 Set precise time bounds
Fix #95 Handle hours/data in any order
Fix #95 Handle hours/data in any order
Fixed #88 Opening hours across Midnight
Fixed #88 Opening hours across Midnight
Added support for immutable dates
setData() and getData()TimeRange::fromArray() and TimeRange::fromDefinition() (to support array of hours+data or string[] or string)setFilters() and getFilters()⚠ Breaking changes:
nextOpen() and nextClose() return type changed for DateTimeInterface as it can now return DateTimeImmutable tootoDateTime() changed both input type and return type for DateTimeInterface as it can now take and return DateTimeImmutable tooAdded support for immutable dates
setData() and getData()TimeRange::fromArray() and TimeRange::fromDefinition() (to support array of hours+data or string[] or string)setFilters() and getFilters()⚠ Breaking changes:
nextOpen() and nextClose() return type changed for DateTimeInterface as it can now return DateTimeImmutable tootoDateTime() changed both input type and return type for DateTimeInterface as it can now take and return DateTimeImmutable tooAllow to merge overlapping hours #43
overspilling timerange will now contain start time
- Added nextClose
nextCloseAdded additional helpers on Time
TimeAdded the ability to pass a DateTime instance to mutate to Time::toDateTime
DateTime instance to mutate to Time::toDateTimeAdded OpeningHours::forWeekCombined()
OpeningHours::forWeekCombined()Added the ability to add recurring exceptions
Fixed bug where checking on times starting at midnight would cause an infinite loop
Added regularClosingDays, regularClosingDaysISO and exceptionalClosingDates methods
regularClosingDays, regularClosingDaysISO and exceptionalClosingDates methodsAdded asStructuredData to retrieve the opening hours as a Schema.org structured data array
- Added timezone support
- isClosedOn fix
isClosedOn fixfixed missing import in Time class
fixed missing import in Time class
Replaced DateTime by DateTimeInterface
DateTime by DateTimeInterface- First release
Nothing published for this version
One column per quarter.