spatie/holidays
Spatie's PHP package calculates public holidays for a country. Call Holidays::for('be')->get() to receive Holiday objects with localized names, CarbonImmutable dates, and types. Supports many countries via ISO 3166-1 alpha-2 codes or country instances. Requires PHP 8.4+.
Holidays::has() and the country directory give an explicit, checkable coverage matrix. Before committing to a launch market we can ask "do we support its holidays, and at what granularity?" instead of discovering the gap three sprints in.Holidays::for('be', locale: 'fr')) mean a localized UI with near-zero copy effort — good value per engineering hour.getUpcoming(n) for notification/reminder features; getInRange() with year/month shorthand for reporting periods; getLongWeekends() for travel, retail, and pricing experiments; isHoliday() for blocking deploys, batch jobs, or outbound comms; HolidayType (national / regional / religious / observed / banked) to let customers filter what counts for them.Adopt when:
isHoliday) and are happy to wrap it behind our own interface.composer require spatie/holidays and a snapshot test is an afternoon, not a project.Look elsewhere or build when:
supportedYearRange() (e.g., 2024–2037); multi-year forecasting products will hit that ceiling.Risk posture: modest adoption (~400 stars, few declared dependents — notably low for a Spatie package) and the score sits mid-range. Signals in favor: MIT, changelog discipline, tagged releases, snapshot-tested country data, active contributor flow. Signals against: bus factor and data quality rest on volunteers, and country coverage quality will be uneven. Treat it as a good default, not an authoritative source.
To executives: This is a free, MIT-licensed library that removes a permanent, low-value maintenance chore — keeping holiday calendars accurate across the countries we operate in. It's a small integration, not a platform bet: one Composer dependency, straightforward to replace. It unblocks "business-day aware" features (delivery promises, due dates, SLAs, staffing, localized holiday messaging) and gives us a clear coverage list for deciding which markets we can credibly claim to support. The one caveat to state plainly: it is not a compliance product. We still own the policy calls on payroll and statutory leave.
To engineering: composer require spatie/holidays, immutable Carbon dates, JSON-serializable output, an API that reads well (for(), get(), getInRange(), isHoliday(), getUpcoming(), getLongWeekends()), plus region and locale options. Two real constraints: PHP 8.4+, and country data is community-contributed with snapshot tests, so it's good but not guaranteed. Wrap it in a single CalendarService interface on day one — that caps our exposure and makes a swap a one-day job.
Ask: approve a short spike — validate our top three to five countries (including any region variants and observed-day rules) with snapshot tests, confirm the PHP 8.4 upgrade path, and come back with an adopt/wrap/replace recommendation.
How can I help you explore Laravel packages today?