spatie/opening-hours
A helper to query and format a set of opening hours
4.2.2
6.2M downloads/mo
#1616 most downloaded on Packagist
spatie/opening-hours
What this package is like to depend on
Last release 1 months ago
09 Jul 2026
Release timing varies
gaps range from 9 days to 1.1 years
Nearly every release is documented
notes for 56 of 60 stable releases
Nothing withdrawn
no release was ever pulled
10 years old
62 releases · first in 2016
1 release in the last 12 months
see the full history below
Release timeline
60 releases · Sep 2016 to Jul 2026Releases
latest 60 of 62-
4.2.209 Jul 2026Release notes
Open source →What's Changed
- Fix Time comparison to ignore metadata and date context by @Amunak in #281
- Add
Time::isSameOrBefore() - Update issue template by @AlexVanderbist in #278
- Add tests for PHP 8.5 by @Chris53897 in #280
- Allow PHPUnit 12 by @Chris53897 in #279
New Contributors
- @AlexVanderbist made their first contribution in #278
- @Amunak made their first contribution in #281
Full Changelog: 4.2.1...4.2.2
Release notes
Open source →- Add
Time::isSameOrBefore() - Fix
Time::isBefore()andTime::isAfter()comparing metadata and date context instead of clock time only
-
4.2.124 May 2025Release notes
Open source →What's Changed
- Fix previousClose with custom timezone by @kylekatarnls in #276
Full Changelog: 4.2.0...4.2.1
-
4.2.017 Feb 2025 -
4.1.311 Feb 2025Release notes
Open source →What's Changed
- Allow 'dateTimeClass' in mergeOverlappingRanges and createAndMerge* by @kylekatarnls in #267
Full Changelog: 4.1.2...4.1.3
-
4.1.218 Dec 2024Release notes
Open source → -
4.1.111 Dec 2024Release notes
Open source →What's Changed
- Update implicit nullable by @michaelw85 in #264
New Contributors
- @michaelw85 made their first contribution in #264
Full Changelog: 4.1.0...4.1.1
-
4.1.027 Nov 2024Release notes
Open source →What's Changed
- Fix
isAlwaysClosedandisAlwaysOpenwhen opening hours contain exceptions by @jordyvanderhaegen in #262
New Contributors
- @jordyvanderhaegen made their first contribution in #262
Full Changelog: 4.0.3...4.1.0
Release notes
Open source →- Fix
isAlwaysClosedandisAlwaysOpenwhen opening hours contain exceptions
- Fix
-
4.0.317 Nov 2024Release notes
Open source →What's Changed
- Fix
nextClose()result with overflow over night by @kylekatarnls in #259
Full Changelog: 4.0.2...4.0.3
- Fix
-
4.0.224 Oct 2024Release notes
Open source →What's Changed
- Handle opening-time with the first minute of day only by @kylekatarnls in #256
Full Changelog: 4.0.1...4.0.2
-
4.0.119 Oct 2024Release notes
Open source →What's Changed
- Allow date without year in validFrom/validTo structured data
Full Changelog: 4.0.0...4.0.1
-
4.0.026 Jun 2024Release notes
Open source →- Replace
getData()with readonly property->data - Added
isAlwaysOpen()andisAlwaysClosed()methods - Converted
Dayto anenum - Made
TimeandTimeRangereadonly - Support OpeningHoursSpecification structured data for creating
OpeningHours - Improve
createFromStructuredData() - Update PHPUnit from 10 to 11 and multiple testing tools
- Check both start and end to consider a range before/after
- Drop PHP < 8.2
- Replace
-
3.0.012 Nov 2023Release notes
Open source →- Add
Time::date()method - Add
DateTimeRangeclass - Add ranges support via
toor-separator - Deprecate
fill()andsetData() - Remove
setFilters()
- Add
-
2.41.012 Jun 2023 -
2.13.007 Aug 2022 -
2.12.024 Jul 2022 -
2.11.323 Jul 2022 -
2.11.209 Dec 2021 -
2.11.125 Nov 2021 -
2.11.013 Oct 2021 -
2.10.110 Dec 2020 -
2.10.006 Nov 2020 -
2.9.115 Oct 2020 -
2.9.003 Sep 2020 -
2.8.019 Jun 2020 -
2.7.218 Jun 2020Release notes
Open source →- Fix support of data/filters/overflow with
OpeningHours::createAndMergeOverlappingRanges()andOpeningHours::mergeOverlappingRanges()
- Fix support of data/filters/overflow with
-
2.7.127 May 2020 -
2.7.027 Aug 2019 -
2.6.018 Jul 2019Release notes
Open source →- Allowed to retrieve current and previous opening hours
- Added
previousOpen() - Added
previousClose() - Added
currentOpenRange() - Added
currentOpenRangeStart() - Added
currentOpenRangeEnd()
-
2.5.006 Jul 2019 -
2.4.119 Jun 2019 -
2.4.019 Jun 2019 -
2.3.314 Jun 2019 -
2.3.210 Jun 2019Release notes
Open source →- Fixed #115 return
24:00whenTime::fromString('24:00')is casted to string
- Fixed #115 return
-
2.3.106 Jun 2019 -
2.3.005 Jun 2019Release notes
Open source →⚠ TimeRange no longer return true on containsTime for times overflowing next day. Overflow is now calculated at the day level (OpeningHoursForDay).
- Added
OpeningHoursForDay::isOpenAtNight() - Added
TimeRange::overflowsNextDay()
- Added
-
2.2.104 Jun 2019 -
2.2.007 May 2019Release notes
Open source →- Allowed opening hours overflowing on the next day by passing
'overflow' => trueoption in array definition
- Allowed opening hours overflowing on the next day by passing
-
2.1.214 Mar 2019 -
2.1.122 Feb 2019 -
2.1.014 Feb 2019 -
2.1.0-beta.1no date pre-releaseNothing published for this version
-
2.0.011 Dec 2018Release notes
Open source →- Added support for immutable dates
- Allowed to add meta-data to global/exceptions config, days config, ranges settings via
setData()andgetData() - Allowed dynamic opening hours settings
- Added
TimeRange::fromArray()andTimeRange::fromDefinition()(to support array of hours+data or string[] or string) - Added
setFilters()andgetFilters()
⚠ Breaking changes:
nextOpen()andnextClose()return type changed forDateTimeInterfaceas it can now returnDateTimeImmutabletootoDateTime()changed both input type and return type forDateTimeInterfaceas it can now take and returnDateTimeImmutabletoo
-
2.0.0-beta.1no date pre-releaseNothing published for this version
-
1.9.007 Dec 2018Release notes
Open source → -
1.8.118 Oct 2018 -
1.8.017 Sep 2018 -
1.7.002 Aug 2018 -
1.6.026 Mar 2018Release notes
Open source →- Added the ability to pass a
DateTimeinstance to mutate toTime::toDateTime
- Added the ability to pass a
-
1.5.026 Feb 2018 -
1.4.015 Sep 2017 -
1.3.113 Sep 2017Release notes
Open source →- Fixed bug where checking on times starting at midnight would cause an infinite loop
-
1.3.001 Jun 2017Release notes
Open source →- Added
regularClosingDays,regularClosingDaysISOandexceptionalClosingDatesmethods
- Added
-
1.2.003 Jan 2017Release notes
Open source →- Added
asStructuredDatato retrieve the opening hours as a Schema.org structured data array - Added
nextOpenmethod to determine the next time the business will be open - Added utility methods:
OpeningHours::map,OpeningHours::flatMap,OpeningHours::mapExceptions,OpeningHours::flatMapExceptions,OpeningHoursForDay::mapandOpeningHoursForDay::empty
- Added
-
1.1.009 Nov 2016 -
1.0.318 Oct 2016 -
1.0.213 Oct 2016 -
1.0.113 Oct 2016 -
1.0.007 Oct 2016 -
0.3.106 Oct 2016Nothing published for this version
-
0.3.006 Oct 2016Nothing published for this version