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

Product Decisions This Supports

  • Core Feature Development: Enables precise business-hour logic for appointment scheduling, retail store availability, or service windows (e.g., "Is this location open now?").
  • Roadmap Efficiency: Accelerates time-to-market for location-based features (e.g., "Find open stores near me") by reducing custom validation/parsing logic.
  • Build vs. Buy: Avoids reinventing wheel for complex opening-hour rules (e.g., holidays, seasonal changes, or time-zone-aware exceptions).
  • Use Cases:
    • E-commerce: Dynamic "in-store pickup" availability.
    • Healthcare: Clinic appointment slots tied to provider hours.
    • Logistics: Warehouse/fulfillment center operational windows.
    • Localization: Multi-region support with country-specific public holidays (via integrations like spatie/laravel-activitylog).

When to Consider This Package

  • Adopt if:

    • Your product requires flexible, rule-based opening hours (e.g., "Open 9–5 Mon–Fri, but closed on Thanksgiving").
    • You need real-time validation (e.g., "Can I book an appointment at 3 PM?").
    • Your team lacks bandwidth to maintain custom parsing logic for edge cases (e.g., half-day closures, daylight saving adjustments).
    • You’re using Laravel/Eloquent and want seamless database integration (e.g., storing hours as JSON).
  • Look elsewhere if:

    • You need graphical UI tools for non-technical users to manage hours (consider a frontend library like react-opening-hours).
    • Your use case is extremely niche (e.g., military time zones with DST exceptions not covered by the package).
    • You’re not using PHP/Laravel (though the core logic could be ported).

How to Pitch It (Stakeholders)

For Executives: "This package lets us ship location-aware availability features faster—think ‘open now’ badges, appointment scheduling, or store finders—without building and maintaining custom logic. It handles edge cases like holidays and time zones, reducing support costs. For example, a retail client could use it to show real-time store hours across 50 locations, with seasonal adjustments, in weeks instead of months."

For Engineering: *"Spatie’s opening-hours gives us a battle-tested, MIT-licensed solution for parsing and validating complex business hours. It integrates cleanly with Laravel models (e.g., Store::isOpenAt($datetime)) and supports:

  • Recurring exceptions (e.g., ‘Closed on Christmas’).
  • Time-zone awareness (via PHP’s DateTimeZone).
  • Serialization (store hours as JSON in DB). We’d avoid reinventing wheel for edge cases like ‘open 10 AM–2 PM on the first Saturday of the month.’ Docs are solid, and the package is actively maintained."*
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport