PackageTrack
Sign in Get early access

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 2026
2017 2018 2019 2020 2021 2022 2023 2024 2025 2026
Release Pre-release

Releases

latest 60 of 62
  1. 4.2.2 09 Jul 2026
    Release notes

    What's Changed

    New Contributors

    Full Changelog: 4.2.1...4.2.2

    Open source →
    Release notes
    • Add Time::isSameOrBefore()
    • Fix Time::isBefore() and Time::isAfter() comparing metadata and date context instead of clock time only
    Open source →
  2. 4.2.1 24 May 2025
    Release notes

    What's Changed

    Full Changelog: 4.2.0...4.2.1

    Open source →
    Release notes
    • Fix previousClose with custom timezone
    Open source →
  3. 4.2.0 17 Feb 2025
    Release notes

    What's Changed

    • Merge time ranges takes in to account the data field, by @jhorie in #269

    New Contributors

    Full Changelog: 4.1.3...4.2.0

    Open source →
    Release notes
    • Merge time ranges takes into account the data field
    Open source →
  4. 4.1.3 11 Feb 2025
    Release notes

    What's Changed

    • Allow 'dateTimeClass' in mergeOverlappingRanges and createAndMerge* by @kylekatarnls in #267

    Full Changelog: 4.1.2...4.1.3

    Open source →
    Release notes
    • Allow 'dateTimeClass' in mergeOverlappingRanges and createAndMerge*
    Open source →
  5. 4.1.2 18 Dec 2024
    Release notes

    What's Changed

    Full Changelog: 4.1.1...4.1.2

    Open source →
    Release notes
    • Update implicit nullable
    Open source →
  6. 4.1.1 11 Dec 2024
    Release notes

    What's Changed

    New Contributors

    Full Changelog: 4.1.0...4.1.1

    Open source →
    Release notes
    • Update implicit nullable
    Open source →
  7. 4.1.0 27 Nov 2024
    Release notes

    What's Changed

    New Contributors

    Full Changelog: 4.0.3...4.1.0

    Open source →
    Release notes
    • Fix isAlwaysClosed and isAlwaysOpen when opening hours contain exceptions
    Open source →
  8. 4.0.3 17 Nov 2024
    Release notes

    What's Changed

    Full Changelog: 4.0.2...4.0.3

    Open source →
    Release notes
    • Fix nextClose() result with overflow overnight
    Open source →
  9. 4.0.2 24 Oct 2024
    Release notes

    What's Changed

    Full Changelog: 4.0.1...4.0.2

    Open source →
    Release notes
    • Handle opening-time with the first minute of day only
    Open source →
  10. 4.0.1 19 Oct 2024
    Release notes

    What's Changed

    • Allow date without year in validFrom/validTo structured data

    Full Changelog: 4.0.0...4.0.1

    Open source →
    Release notes
    • Allow date without year in validFrom/validTo structured data
    Open source →
  11. 4.0.0 26 Jun 2024
    Release notes
    • Replace getData() with readonly property ->data
    • Added isAlwaysOpen() and isAlwaysClosed() methods
    • Converted Day to an enum
    • Made Time and TimeRange readonly
    • 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
    Open source →
  12. 3.0.0 12 Nov 2023
    Release notes
    • Add Time::date() method
    • Add DateTimeRange class
    • Add ranges support via to or - separator
    • Deprecate fill() and setData()
    • Remove setFilters()
    Open source →
  13. 2.41.0 12 Jun 2023
    Release notes
    • Cap holidays check to end date when calculating diff
    Open source →
  14. 2.13.0 07 Aug 2022
    Release notes
    • Make comparison microsecond-precise
    Open source →
  15. 2.12.0 24 Jul 2022
    Release notes
    • Apply timezone for all methods and both input/output
    Open source →
  16. 2.11.3 23 Jul 2022
    Release notes
    • Copy non immutable dates to apply timezone
    Open source →
  17. 2.11.2 09 Dec 2021
    Release notes
    • Add array-shape create() PHPDoc
    Open source →
  18. 2.11.1 25 Nov 2021
    Release notes
    • Fix compatibility with PHP 8.1
    Open source →
  19. 2.11.0 13 Oct 2021
    Release notes
    • Add dateTimeClass option to use other class for date objects
    Open source →
  20. 2.10.1 10 Dec 2020
    Release notes
    • Fix "hours" merge in mergeOverlappingRanges
    Open source →
  21. 2.10.0 06 Nov 2020
    Release notes
    • Add "hours" key support in mergeOverlappingRanges
    Open source →
  22. 2.9.1 15 Oct 2020
    Release notes
    • Use OpeningHours timezone for isOpenOn()
    Open source →
  23. 2.9.0 03 Sep 2020
    Release notes
    • Allow isOpenOn() to take date string as parameter
    Open source →
  24. 2.8.0 19 Jun 2020
    Release notes
    • Add Time::diff() methods
    Open source →
  25. 2.7.2 18 Jun 2020
    Release notes
    • Fix support of data/filters/overflow with OpeningHours::createAndMergeOverlappingRanges() and OpeningHours::mergeOverlappingRanges()
    Open source →
  26. 2.7.1 27 May 2020
    Release notes
    • Added InvalidTimezone exception
    Open source →
  27. 2.7.0 27 Aug 2019
    Release notes
    • Added forWeekConsecutiveDays() method
    Open source →
  28. 2.6.0 18 Jul 2019
    Release notes
    • Allowed to retrieve current and previous opening hours
    • Added previousOpen()
    • Added previousClose()
    • Added currentOpenRange()
    • Added currentOpenRangeStart()
    • Added currentOpenRangeEnd()
    Open source →
  29. 2.5.0 06 Jul 2019
    Release notes
    • Allowed #128 un-ordered ranges
    Open source →
  30. 2.4.1 19 Jun 2019
    Release notes
    • Added #121 timezone supporrt in TimeRange::format()
    Open source →
  31. 2.4.0 19 Jun 2019
    Release notes
    • Added #121 custom format and timezone support in asStructuredData()
    Open source →
  32. 2.3.3 14 Jun 2019
    Release notes
    • Fixed merge when last range of day ends with 24:00
    Open source →
  33. 2.3.2 10 Jun 2019
    Release notes
    • Fixed #115 return 24:00 when Time::fromString('24:00') is casted to string
    Open source →
  34. 2.3.1 06 Jun 2019
    Release notes
    • Added a MaximumLimitExceeded exception to prevent infinite loop
    Open source →
  35. 2.3.0 05 Jun 2019
    Release notes

    ⚠ 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()
    Open source →
  36. 2.2.1 04 Jun 2019
    Release notes
    • Fixed #111 overflow with simple ranges and add tests
    Open source →
  37. 2.2.0 07 May 2019
    Release notes
    • Allowed opening hours overflowing on the next day by passing 'overflow' => true option in array definition
    Open source →
  38. 2.1.2 14 Mar 2019
    Release notes
    • Fixed #98 Set precise time bounds
    Open source →
  39. 2.1.1 22 Feb 2019
    Release notes
    • Fixed #95 Handle hours/data in any order
    Open source →
  40. 2.1.0 14 Feb 2019
    Release notes
    • Fixed #88 Opening hours across Midnight
    • Fixed #89 Data support for next open hours
    • Implemented #93 Enable PHP 8
    Open source →
  41. 2.1.0-beta.1 no date pre-release

    Nothing published for this version

  42. 2.0.0 11 Dec 2018
    Release notes
    • Added support for immutable dates
    • Allowed to add meta-data to global/exceptions config, days config, ranges settings via setData() and getData()
    • Allowed dynamic opening hours settings
    • Added TimeRange::fromArray() and TimeRange::fromDefinition() (to support array of hours+data or string[] or string)
    • Added setFilters() and getFilters()

    ⚠ Breaking changes:

    • nextOpen() and nextClose() return type changed for DateTimeInterface as it can now return DateTimeImmutable too
    • toDateTime() changed both input type and return type for DateTimeInterface as it can now take and return DateTimeImmutable too
    Open source →
  43. 2.0.0-beta.1 no date pre-release

    Nothing published for this version

  44. 1.9.0 07 Dec 2018
    Release notes
    • Allowed to merge overlapping hours #43
    • Fixed nextOpen() and nextClose() consecutive calls #73
    Open source →
  45. 1.8.1 18 Oct 2018
    Release notes
    • Added start time to overspilling timeranges
    Open source →
  46. 1.8.0 17 Sep 2018
    Release notes
    • Added nextClose
    Open source →
  47. 1.7.0 02 Aug 2018
    Release notes
    • Added additional helpers on Time
    Open source →
  48. 1.6.0 26 Mar 2018
    Release notes
    • Added the ability to pass a DateTime instance to mutate to Time::toDateTime
    Open source →
  49. 1.5.0 26 Feb 2018
    Release notes
    • Added OpeningHours::forWeekCombined()
    Open source →
  50. 1.4.0 15 Sep 2017
    Release notes
    • Added the ability to add recurring exceptions
    Open source →
  51. 1.3.1 13 Sep 2017
    Release notes
    • Fixed bug where checking on times starting at midnight would cause an infinite loop
    Open source →
  52. 1.3.0 01 Jun 2017
    Release notes
    • Added regularClosingDays, regularClosingDaysISO and exceptionalClosingDates methods
    Open source →
  53. 1.2.0 03 Jan 2017
    Release notes
    • Added asStructuredData to retrieve the opening hours as a Schema.org structured data array
    • Added nextOpen method to determine the next time the business will be open
    • Added utility methods: OpeningHours::map, OpeningHours::flatMap, OpeningHours::mapExceptions, OpeningHours::flatMapExceptions,OpeningHoursForDay::map and OpeningHoursForDay::empty
    Open source →
  54. 1.1.0 09 Nov 2016
    Release notes
    • Added timezone support
    Open source →
  55. 1.0.3 18 Oct 2016
    Release notes
    • isClosedOn fix
    Open source →
  56. 1.0.2 13 Oct 2016
    Release notes
    • Fixed missing import in Time class
    Open source →
  57. 1.0.1 13 Oct 2016
    Release notes
    • Replaced DateTime by DateTimeInterface
    Open source →
  58. 1.0.0 07 Oct 2016
    Release notes
    • First release
    Open source →
  59. 0.3.1 06 Oct 2016

    Nothing published for this version

  60. 0.3.0 06 Oct 2016

    Nothing published for this version

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive