Weave 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

Php Datetime Ago Laravel Package

smirik/php-datetime-ago

A small PHP library that turns timestamps and DateTime objects into human-friendly "time ago" strings like "5 minutes ago" or "2 days ago." Lightweight, no framework required, with configurable formats and simple, localization-friendly output for feeds, comments, and ac...

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. smirik/php-datetime-ago is a single-purpose string formatter: give it a timestamp (or two DateTime objects) and it returns human-readable relative text ("3 days ago"). It has no framework coupling, no service provider, no config, and no persistence concerns. Architecturally it would slot in anywhere — which is precisely the problem, because Laravel already ships that capability via Carbon ($date->diffForHumans()) with better locale, timezone, and boundary handling.

Integration feasibility. Technically trivial: a Composer require plus one call site. The real question is not "can we install it" but "why would we." With 22 stars, zero dependents, and a single maintainer, this package is not a dependency so much as a code snippet distributed via Packagist. For most teams the cheapest viable integration is to copy the ~50 lines of logic into a app/Support/RelativeTime.php helper or, better, call Carbon directly.

Technical risk. The dominant risk is abandonment, not bugs. Specific unknowns: PHP 8.x compatibility (the package predates the modern runtime matrix), PSR-4/Composer 2 hygiene, timezone and DST correctness at boundaries, behaviour for future timestamps and sub-second deltas, and hard-coded English strings with no Translator awareness. Since there is no test suite or CI signal to lean on, any adoption requires us to write the characterization tests ourselves.

Key questions. Does it accept DateTimeInterface or only its own types? How does it handle timezones — does it normalize to a reference zone before diffing? Are strings hard-coded or injectable for i18n? What does it emit for "just now," future dates, and DST transitions? Which PHP versions are declared in composer.json, and does it install cleanly against our current lockfile? Is there a documented release cadence or is the repo dormant?

Recommendation to the review board: treat this as a reference implementation, not a dependency. The adoption cost (vendor review, fork risk, test burden) exceeds the build cost of reimplementing the behaviour on Carbon.

Integration Approach

Stack fit. Poor in a Laravel context specifically, because Carbon is already a transitive dependency of the framework and exposes diffForHumans() with locale switching through Carbon::setLocale(), configurable ago/from now phrasing, and well-tested handling of future dates. Introducing a second relative-time formatter alongside Carbon creates two sources of truth for user-facing date copy — a genuine consistency hazard once product asks for "yesterday" instead of "1 day ago."

Migration path. If any legacy code already calls this package, the migration is mechanical: replace the formatter call with $date->diffForHumans($other, ['syntax' => CarbonInterface::DIFF_RELATIVE_TO_NOW]) and delete the dependency. Expect a small number of call sites — the package is too narrow to be deeply embedded. Budget half a day including snapshot-test updates where output wording changes.

Compatibility. Verify PHP version support against our runtime (Laravel 10/11 implies PHP 8.1+) before anything else; a package of this vintage may declare php: >=5.3 without testing modern versions. Also confirm it does not pull a conflicting nesbot/carbon or symfony/translation constraint — that is the most plausible way a harmless utility breaks a lockfile.

Sequencing. (1) Inventory existing call sites and their exact output strings. (2) Capture those strings as snapshot tests so wording drift is visible. (3) Swap to Carbon behind a thin RelativeTimeFormatter interface we own. (4) Remove the package. If, for some reason, business rules demand a bespoke phrasing scheme, keep our interface and implement it there — never re-add the vendor dependency.

Operational Impact

Maintenance. Effectively zero upstream maintenance and therefore non-zero downstream burden: we would own the code whether or not we own the repository. For a formatter this small, forking or inlining is strictly cheaper than tracking a dormant upstream, and it removes a supply-chain node for free.

Support. No vendor, no SLA, no security disclosure process. The blast radius of a compromise or bug is small (display strings only, no I/O, no deserialization), but our dependency review still has to record an exception. That exception costs more in policy overhead than the code saves.

Scaling. Negligible performance surface — string formatting on the request path is microseconds. If relative timestamps appear in list views, the real scaling consideration is caching rendered output or formatting client-side from ISO-8601 timestamps, not the library choice.

Failure modes. Watch for: incorrect output across timezones when the server and user zones differ; DST-boundary off-by-one-hour phrasing; nonsensical results for future timestamps ("in -2 days"); English-only output colliding with a localized product; and unhandled null/invalid input throwing rather than degrading. Each of these is a support ticket class we would rather inherit from Carbon, which has already closed them.

Ramp-up. Minutes — any developer can read the entire source in one sitting. That low ramp-up is itself the argument: if the code is that small and that legible, the dependency earns nothing. The ramp-up cost that does matter is organizational — getting an unmaintained package through vendor review, and re-litigating that decision at every audit cycle.

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.
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk