Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Opening Hours Laravel Package

spatie/opening-hours

Define and query business opening hours with weekly schedules and exceptions. Check if a date/time is open or closed, get next open/close times, and format hours per day. Integrates with Carbon via cmixin/business-time for date-based queries.

View on GitHub
Deep Wiki
Context7
4.2.2
  • Add Time::isSameOrBefore()
  • Fix Time::isBefore() and Time::isAfter() comparing metadata and date context instead of clock time only
4.2.1
  • Fix previousClose with custom timezone
4.2.0
  • Merge time ranges takes into account the data field
4.1.3
  • Allow 'dateTimeClass' in mergeOverlappingRanges and createAndMerge*
4.1.2
  • Update implicit nullable
4.1.1
  • Update implicit nullable
4.1.0
  • Fix isAlwaysClosed and isAlwaysOpen when opening hours contain exceptions
4.0.3
  • Fix nextClose() result with overflow overnight
4.0.2
  • Handle opening-time with the first minute of day only
4.0.1
  • Allow date without year in validFrom/validTo structured data
4.0.0
  • Replace getData() with readonly property ->data
3.0.0
  • Add Time::date() method
  • Add DateTimeRange class
  • Add ranges support via to or - separator
  • Deprecate fill() and setData()
  • Remove setFilters()
2.41.0
  • Cap holidays check to end date when calculating diff
2.13.0
  • Make comparison microsecond-precise
2.12.0
  • Apply timezone for all methods and both input/output
2.11.3
  • Copy non immutable dates to apply timezone
2.11.2
  • Add array-shape create() PHPDoc
2.11.1
  • Fix compatibility with PHP 8.1
2.11.0
  • Add dateTimeClass option to use other class for date objects
2.10.1
  • Fix "hours" merge in mergeOverlappingRanges
2.10.0
  • Add "hours" key support in mergeOverlappingRanges
2.9.1
  • Use OpeningHours timezone for isOpenOn()
2.9.0
  • Allow isOpenOn() to take date string as parameter
2.8.0
  • Add Time::diff() methods
2.7.2
  • Fix support of data/filters/overflow with OpeningHours::createAndMergeOverlappingRanges() and OpeningHours::mergeOverlappingRanges()
2.7.1
  • Added InvalidTimezone exception
2.7.0
  • Added forWeekConsecutiveDays() method
2.6.0
  • Allowed to retrieve current and previous opening hours
  • Added previousOpen()
  • Added previousClose()
  • Added currentOpenRange()
  • Added currentOpenRangeStart()
  • Added currentOpenRangeEnd()
2.5.0
  • Allowed #128 un-ordered ranges
2.4.1
  • Added #121 timezone supporrt in TimeRange::format()
2.4.0
  • Added #121 custom format and timezone support in asStructuredData()
2.3.3
  • Fixed merge when last range of day ends with 24:00
2.3.2
  • Fixed #115 return 24:00 when Time::fromString('24:00') is casted to string
2.3.1
  • Added a MaximumLimitExceeded exception to prevent infinite loop
2.3.0

⚠ 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()
2.2.1
  • Fixed #111 overflow with simple ranges and add tests
2.2.0
  • Allowed opening hours overflowing on the next day by passing 'overflow' => true option in array definition
2.1.2
  • Fixed #98 Set precise time bounds
2.1.1
  • Fixed #95 Handle hours/data in any order
2.1.0
  • Fixed #88 Opening hours across Midnight
  • Fixed #89 Data support for next open hours
  • Implemented #93 Enable PHP 8
2.0.0
  • 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
1.9.0
  • Allowed to merge overlapping hours #43
  • Fixed nextOpen() and nextClose() consecutive calls #73
1.8.1
  • Added start time to overspilling timeranges
1.8.0
  • Added nextClose
1.7.0
  • Added additional helpers on Time
1.6.0
  • Added the ability to pass a DateTime instance to mutate to Time::toDateTime
1.5.0
  • Added OpeningHours::forWeekCombined()
1.4.0
  • Added the ability to add recurring exceptions
1.3.1
  • Fixed bug where checking on times starting at midnight would cause an infinite loop
1.3.0
  • Added regularClosingDays, regularClosingDaysISO and exceptionalClosingDates methods
1.2.0
  • 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
1.1.0
  • Added timezone support
1.0.3
  • isClosedOn fix
1.0.2
  • Fixed missing import in Time class
1.0.1
  • Replaced DateTime by DateTimeInterface
1.0.0
  • First release
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
ecotone/kafka
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata