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

Time Ago Bundle Laravel Package

softspring/time-ago-bundle

Softspring TimeAgoBundle adds a simple Twig filter for rendering dates and timestamps as human-friendly relative time, such as “5 minutes ago” or “2 days ago.” It helps Symfony applications show compact, readable age labels in templates without custom date logic.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Install with composer require softspring/time-ago-bundle. Note the name: this is a Symfony bundle, not a Laravel package. There is no ServiceProvider, no config/time-ago.php to publish, and no package discovery entry.
  • Look first at vendor/softspring/time-ago-bundle/README.md, then DependencyInjection/ (config tree + service wiring) and any Twig/ directory (the filter/extension is usually the public surface). Those three files tell you the entire usable API.
  • Before you install it in a Laravel app, check whether you need it at all. Laravel already ships Carbon, and $post->created_at->diffForHumans() produces the same "3 hours ago" output with locale support from app()->getLocale(). For most Laravel codebases this package is redundant.
  • First real use case: you have a Symfony app (or a Laravel app embedding Symfony components) and you want a translator-backed, template-level relative-time filter rather than calling Carbon in every view.

Implementation Patterns

  • Blade, the 90% case: {{ $post->created_at->diffForHumans() }}. Add ->diffForHumans(short: true) for "3h ago" style output.
  • Keep formatting out of views. Use an accessor (Attribute::make(get: fn () => $this->created_at->diffForHumans())) or a TimeAgo helper class, so you can change phrasing or locale in one place.
  • Never emit only the human string from a JSON API. Return created_at as ISO-8601 alongside created_at_human, otherwise clients can't sort or re-render.
  • Client-side hydration for anything long-lived. A server-rendered "2 minutes ago" is wrong the moment the page leaves the server. Pair it with an Alpine/Livewire ticker or <time datetime="..."> that JS rewrites, and keep the server string as the no-JS fallback.
  • If you do want the bundle's formatter in Laravel, wrap it: bind the bundle's formatter service in a small service provider and inject it, rather than calling static helpers. Decorate it if you need custom phrasing.
  • Testing: Carbon::setTestNow() before asserting on the string, and assert against a fixed locale (app()->setLocale('en')), otherwise tests break under a different default locale in CI.

Gotchas and Tips

  • v5.6.0 shipped an empty changelog body — the release notes are only a compare/v5.5.10...v5.6.0 link. Read the actual diff before bumping. Per semver it's a minor release (additive only), but nothing in the published notes confirms that; treat it as unverified.
  • No Laravel integration exists. Installing the bundle in a Laravel app gives you the classes but none of the wiring — nothing auto-registers. You'll be writing glue code, which is usually more than the package saves you.
  • Two locale sources collide. Carbon reads app()->getLocale(); the Symfony bundle reads the translator service. If both are in play you'll get inconsistent strings for the same timestamp.
  • Caching trap. Relative timestamps must never sit in a long-TTL cache or a full-page cache. Either shorten the TTL, cache only the absolute timestamp, or render the relative part on the client.
  • Timezones. Store UTC and call diffForHumans() on a Carbon instance already converted to the display timezone. diffForHumans() on a naive local string stored as UTC is silently off by the offset — a very common bug with "just now" labels.
  • Extension point: the formatter is a container service — decorate or alias it instead of forking the bundle. That survives minor upgrades like this one.
  • Pin the version. With no usable release notes, an exact constraint ("5.5.*") and a manual diff review is safer than floating on ^5.6 until you've confirmed the change set.
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.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
cgv/localized-resource