chrisdicarlo/eloquent-human-timestamps
Adds human-readable accessors to Eloquent models so timestamp columns like created_at and updated_at can render as phrases such as "3 hours ago" or "in 2 days." Simple Laravel trait integration, customizable formatting, no schema changes needed.
eloquent-human-timestamps is a narrow, single-purpose Laravel package that layers human-readable relative timestamps (e.g. "3 hours ago") onto Eloquent model attributes, most likely via a trait, cast, or accessor over created_at / updated_at. Architecturally it sits entirely inside the application layer — no service provider obligations beyond package discovery, no persistence changes, no external dependencies beyond Carbon and the framework itself. That makes it a low-coupling, low-blast-radius addition.
Architecture fit: Good for applications that surface timestamps to end users (dashboards, activity feeds, admin panels, notification lists) and want consistent formatting without duplicating diffForHumans() calls across views and API resources. It is a poor fit as a system of record for time — the underlying datetime columns remain authoritative, so this is purely a presentation concern. Confirm it does not mutate stored values.
Integration feasibility: High. Typical adoption is composer require plus adding a trait or cast to the models that need it. Expect minutes, not days, of engineering effort.
Technical risk: Low but non-zero. The v6.1.0 change is a Laravel 12 compatibility addition — a maintenance signal rather than a feature. The material risks are:
created_at, toArray() / toJson() output may change from ISO-8601 to a human string, silently breaking API consumers or front-end date parsing. This is the most likely production incident associated with adoption.Key questions for the maintainer / engineering spike:
illuminate/* constraints to include ^12.0 while retaining ^10.0/^11.0, or does it drop older framework versions?toArray()/toJson() output, and is that behavior opt-in per model or global?Stack fit: Compatible with any standard Laravel application on the 10.x–12.x line, assuming the constraint check above passes. It introduces no new runtime services, no queue workers, no cache stores, and no infrastructure requirements, so it fits both monolith and modular/domain-oriented Laravel codebases. In a DDD-style layout, apply it at the presentation/resource boundary rather than inside domain entities to avoid leaking view concerns into the model layer.
Migration path: Straightforward greenfield adoption. For teams already calling ->diffForHumans() manually in Blade templates or API resources, the migration is a consolidation refactor — replace ad-hoc formatting with the package's trait or cast, then delete the duplicated helpers. There is no data migration and no schema change.
Compatibility: Confirm three axes before merging: (a) framework version constraint vs. our current Laravel version and our planned Laravel 12 upgrade window; (b) PHP version floor vs. our runtime; (c) interaction with any existing date casts, $dateFormat overrides, or custom accessors already defined on the same attributes — accessor collisions are the most common integration failure for packages of this shape. Also check coexistence with API-resource layers (e.g. JsonResource) that may already transform timestamps.
Sequencing:
toArray() output on a representative model.diffForHumans() calls.Maintenance: Minimal ongoing effort. The package has no configuration drift, no scheduled jobs, and no state. The real maintenance cost is dependency hygiene: tracking upstream releases so a future Laravel major doesn't strand us. Budget a recurring line item to verify compatibility each framework upgrade cycle, and keep a documented fallback (a ~50-line trait using Carbon::diffForHumans() with locale handling) so we can vendor the behavior in an afternoon if the package goes unmaintained.
Support: Support burden is near zero for users, but internal support requires a documented convention: which models expose human timestamps, and which surfaces (UI vs. API) consume them. Without that convention, the next developer to touch a resource class may re-introduce manual formatting and fragment the output.
Scaling: Negligible. Formatting is computed per-access at render time; there is no per-request I/O, no query amplification, and no memory concern. The only scaling-adjacent consideration is CPU on high-volume list endpoints rendering hundreds of timestamps per response — measurable in micro-optimization terms only, and not a realistic bottleneck at typical scale. Caching is unnecessary and would introduce staleness bugs (a cached "3 hours ago" is wrong by definition).
Failure modes:
app.locale and app.timezone propagation.Ramp-up: Very low. Any Laravel developer can read the package's surface area in under an hour. The onboarding artifact worth writing is not documentation of the package itself but the team convention for where human timestamps are permitted (view layer yes, API contract no). Estimate: half a day for one engineer to evaluate, integrate, and validate; near-zero for subsequent contributors.
How can I help you explore Laravel packages today?