Query and format a set of opening hours
1.7k
Stars
118
Forks
0
Open issues
30
Contributors
AI Analysis
spatie/opening-hours is a PHP library for querying and formatting business opening hours, including support for recurring schedules, exceptions, and integration with Carbon date objects. It serves businesses, scheduling applications, and developers building location-based services. Best suited for PHP projects needing programmatic access to business hours; not a general-purpose calendar library.
Inferred from signals mentioned in the README (tests, CI, type safety) — not a review of the actual code.
AI's overall editorial judgment — not an average of the bars above, can weigh other factors too.
Spatie's opening-hours: mature PHP library for business hours logic, narrow scope, stable and well-maintained
spatie/opening-hours is a PHP library for querying and formatting business opening hours. It handles recurring schedules, exceptions, timezone-aware queries, and edge cases like overnight hours. Built for developers integrating business hours into applications (e.g., 'are we open now?' checks, displaying hours). Adopted primarily by PHP web developers; adoption not systematically documented but library is well-established in the Spatie ecosystem. Serves a narrow but real problem; not meant to compete with calendar systems or appointment platforms.
Created September 2016 by Spatie (Belgian web development agency). Emerged as a practical extract-to-package pattern from shared client work. Evolved to handle increasingly complex scenarios (overflow hours, recurring exceptions, data attachments) over 10 years. Represents steady, problem-driven development rather than reactive trend-following.
Stars grew to ~1,700 over a decade, suggesting moderate, organic adoption by PHP developers solving similar problems. No spike visible; last 7 days shows 0 new stars, typical for a mature, stable utility. Growth driven by word-of-mouth within Laravel/PHP communities and inclusion in Spatie's high-quality package portfolio, not by marketing.
Adoption not verified via concrete metrics (no public case studies, deployment counts, or user surveys documented in README). However, library is part of Spatie's official open-source portfolio and is available on Packagist with download history badge. Spatie's reputation and other packages' success (Laravel-adjacent ecosystem) suggest real usage, but scale remains unclear. Likely used by PHP agencies and SMB-sized web projects; enterprise adoption unverified.
Appears to be a stateful object model built around the OpeningHours class (based on README examples). Likely supports declarative definition of schedules, exception-based overrides, and query methods (isOpenOn, isOpenAt, forDay, forWeek, exceptions). Supports data attachment to hours ranges, overflow across midnight, and Carbon date library integration via mixin. Object-oriented design typical of Spatie packages.
README indicates passing tests and codecov badge present; coverage not disclosed in README. StyleCI and Scrutinizer badges suggest code quality tooling is active. Exact coverage percentage not documented in truncated README.
Last push 2026-07-09, one day before analysis date — indicates actively maintained. No evidence of stagnation; routine maintenance and bug fixes likely occurring. Build and coverage badges present and maintained. Repository shows 1,722 stars with 118 forks, suggesting stable, trusted codebase. Activity pattern consistent with mature library receiving steady, low-frequency updates rather than rapid development.
ADOPT IF: you are building a PHP application that needs to query or display business opening hours (e.g., 'are we open now?' widgets, availability checking) and your schedule fits the recurring weekly + exception model. The library is stable, well-maintained, and solves the problem cleanly. AVOID IF: you need complex recurrence rules (e.g., RFC 5545 iCal semantics), multi-resource scheduling, timezone-heavy logic (beyond PHP DateTime), or a non-PHP tech stack. Also avoid if you need appointment booking or billing-centric recurring logic; this is read-only hours logic, not a calendar system. MONITOR IF: your application requires high-performance batch queries over millions of date ranges; the README does not discuss performance characteristics or caching strategies.
Independent dimensions
Mainstream potential
2/10
Technical importance
5/10
Adoption evidence
3/10
- Narrow scope may miss edge cases (e.g., DST transitions, leap seconds, or recurring rules more complex than weekly + named exceptions); not documented whether these are handled.
- Adoption not systematically measured; cannot quantify whether it remains widely used in production or if alternatives are gaining traction.
- Dependency on Carbon and PHP ecosystem; upgrading PHP versions or shifting tech stacks may break integration.
- No mention of timezone-aware queries or handling ambiguous times (e.g., 2:00 AM during DST fall-back); implementation details unknown.
- API stability over 10 years is positive but also suggests slow feature evolution; if requirements exceed the model (e.g., nested schedules per room), migration burden may be high.
Likely to remain a stable, low-velocity maintenance project. Adoption will stay confined to PHP / Laravel-adjacent communities. Occasional minor releases for compatibility (PHP 9.x, newer Carbon versions) expected, but feature additions will slow further as the problem is well-solved. No mainstream growth anticipated; project will serve its intended niche indefinitely.
Newsletter
Get analyses like this every Monday
Free weekly digest of the most interesting open-source discoveries.
Languages
Information
- Language
- PHP
- License
- MIT
- Last updated
- 17h ago
- Created
- 119mo ago
- Analyzed with
- anthropic/claude-haiku-4-5
Stars over time
Contributors over time
Top 100 contributors only — repos with more will plateau at 100.
Open issues
No open issues — clean slate.
Open pull requests
No open pull requests.
Top contributors
Recent releases
Similar repos
No similar repos indexed yet — similarity data is generated after AI enrichment.
spatie/opening-hours integrates with Carbon via cmixin/business-time; not a replacement, but complementary. This library provides the structured definition and querying; mixin adds methods to Carbon objects.
Many projects build hours logic directly into appointment or scheduling platforms. spatie/opening-hours is lighter-weight and assumes a simple recurring schedule + exceptions model; not suitable for complex room/resource scheduling.
Those handle arbitrary recurrence rules (RFC 5545). spatie/opening-hours is simpler, fixed to weekly recurrence + named exceptions; trades flexibility for ease of use in common cases.
Focused on different problem (subscription billing, event scheduling). Opening hours is narrower and more domain-specific for displaying/checking business availability.
Equivalent libraries exist for Node/JS ecosystems. spatie/opening-hours is PHP-specific; language choice determines adoption.
