cmixin/business-day
A PHP package for business-day calculations with customizable weekends and holidays. Add or subtract business days, check whether a date is a business day, and handle regional holiday rules—useful for scheduling, deadlines, and Laravel applications.
Architecture fit: Good tactical fit for Laravel/PHP services already using Carbon for dates. The package is a Carbon mixin, not a Laravel domain package, so it fits as a calculation utility rather than an SLA, billing, or scheduling source of truth. It is most valuable where business-day math is scattered across controllers, jobs, and models.
Integration feasibility: High for a small proof of concept. Composer install plus a controlled mixin registration in a service provider is likely enough. Feasibility drops if the product needs business hours, partial holidays, multiple calendars per tenant, audit-grade calendar versioning, or persisted holiday governance—the package handles business-day primitives, not the full policy layer.
Technical risk: Moderate. Key concerns are low visible adoption (406 stars, 0 dependents), single-maintainer OSS dependency, reliance on Carbon internals, and global mixin/state behavior. The listed release date appears future-dated relative to the current date, so release metadata should be verified before relying on it. Holiday data correctness, timezone/DST behavior, mutable vs immutable Carbon, and Octane/queue worker isolation need explicit validation.
Key questions: Which holiday calendars and tenant-specific rules must be supported? Does “business day” mean whole calendar days only, or business hours and cutoffs? Who owns holiday data and its versioning? Are mutable and immutable Carbon both used? What Laravel, PHP, and Carbon versions are in the support matrix? How will calculations be tested against payroll, SLA, and billing edge cases?
Stack fit: Strong for Laravel applications using Carbon 2/3-era date handling. Weak fit as a standalone scheduling engine. Wrap the package behind an internal BusinessCalendar service or value object so controllers, jobs, and domain code do not call mixin methods directly.
Migration path: Run a time-boxed spike against representative date logic: add/subtract business days, holiday exclusion, weekend definitions, month-end, leap year, and DST boundaries. Build golden tests from current behavior. Replace existing manual date math behind a feature flag, starting with low-risk ETA and notification paths before billing or contractual SLAs.
Compatibility: Pin PHP, Laravel, and Carbon versions and test the exact tuple. Verify mutable Carbon and CarbonImmutable behavior, timezone handling, and mixin registration order. Confirm whether the package auto-registers or requires explicit Carbon::mixin(...) setup; if manual, keep registration centralized in AppServiceProvider.
Sequencing: 1) package and license audit; 2) isolated proof of concept with real holiday calendars; 3) internal adapter and configuration model; 4) golden-test suite and timezone/DST tests; 5) pilot one service path; 6) add observability for calendar version and timezone used; 7) expand usage; 8) retain a fork/vendor fallback if maintenance risk materializes.
Maintenance: Low code footprint but non-trivial dependency ownership. MIT license is favorable, but the project has limited adoption signals and likely one primary maintainer. The team should be prepared to pin versions, vendor a fork, or replace the mixin if Carbon compatibility breaks.
Support: No commercial SLA. Internal teams own holiday data, calendar correctness, upgrade testing, and incident response. Product and operations must agree who approves holiday changes and how those changes are audited.
Scaling: Computationally cheap for typical request and job volumes. The larger scaling concern is configuration and state: cache holiday calendars, avoid reloading large datasets per request, and reset or isolate global mixin state in Octane and long-running queue workers.
Failure modes: Wrong or stale holiday calendars; timezone/DST off-by-one errors; inconsistent weekend definitions across tenants; mutable Carbon side effects leaking between calls; mixin conflicts with other Carbon extensions; Carbon or Laravel upgrades changing behavior; and silent divergence between billing, SLA, and notification calculations.
Ramp-up: Low for PHP developers already comfortable with Carbon. Moderate for product, finance, and operations because business-day rules are policy-heavy. Ramp-up should include a short internal guide, calendar-version conventions, test examples, and a clear rule that all business-day calculations go through the internal adapter rather than direct package calls.
How can I help you explore Laravel packages today?