PHPackages                             jimmiw/php-time-ago - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. jimmiw/php-time-ago

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jimmiw/php-time-ago
===================

Simple module, that displays the date in a "time ago" format

3.3.0(2mo ago)2611.1M—8.2%95[1 issues](https://github.com/jimmiw/php-time-ago/issues)[1 PRs](https://github.com/jimmiw/php-time-ago/pulls)14MITPHPPHP &gt;=8.2.0CI failing

Since Jun 25Pushed 2mo ago12 watchersCompare

[ Source](https://github.com/jimmiw/php-time-ago)[ Packagist](https://packagist.org/packages/jimmiw/php-time-ago)[ Docs](https://github.com/jimmiw/php-time-ago)[ RSS](/packages/jimmiw-php-time-ago/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (42)Used By (14)

Add time ago functionality to your project
==========================================

[](#add-time-ago-functionality-to-your-project)

[![Latest Stable Version](https://camo.githubusercontent.com/ac81e8d9e8f91f525bf487555eb9379bb540ed61024f43ab49f034354b004f0e/68747470733a2f2f706f7365722e707567782e6f72672f6a696d6d69772f7068702d74696d652d61676f2f762f737461626c65)](https://packagist.org/packages/jimmiw/php-time-ago)[![Total Downloads](https://camo.githubusercontent.com/6d11f4aa5af0d01b0bc27a9326e86ec19566f0eab8301f2a721834064dae7510/68747470733a2f2f706f7365722e707567782e6f72672f6a696d6d69772f7068702d74696d652d61676f2f646f776e6c6f616473)](https://packagist.org/packages/jimmiw/php-time-ago)[![Build Status](https://camo.githubusercontent.com/68a53111d2f2d167658cf32fd7acdce45e1e2cdaa80580503d010f3e07d8808d/68747470733a2f2f7472617669732d63692e6f72672f6a696d6d69772f7068702d74696d652d61676f2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jimmiw/php-time-ago)[![License](https://camo.githubusercontent.com/ddf3e2e5b06fc61581fba3da5487f16de5846f55553c8199a433e36ec412805a/68747470733a2f2f706f7365722e707567782e6f72672f6a696d6d69772f7068702d74696d652d61676f2f6c6963656e7365)](https://packagist.org/packages/jimmiw/php-time-ago)[![OpenCollective](https://camo.githubusercontent.com/0a647b049a8520b5c400c6d0200efbbfb698b8cb0edf76f411750ff8bfaf4125/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b6572732f62616467652e737667)](#backers)[![OpenCollective](https://camo.githubusercontent.com/c5f637218f0bedc03ec5b0f658322f21cdc8e5eec4164b6df8d23872012b7fd8/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f72732f62616467652e737667)](#sponsors)

Getting started
===============

[](#getting-started)

The package is availabe here on Github and on Packagist

-
-

Installing
----------

[](#installing)

Using composer you can just do the following

```
composer require jimmiw/php-time-ago

```

PHP Version notes
-----------------

[](#php-version-notes)

From version 3.3.0, we are not supporting the old php version. This is PHP 8.2 and up. This change was done, as there are security issues with older version of both PHP and PHPUnit.

This means that version 3.2.x and below support PHP 8.1 and below.

Using the component
-------------------

[](#using-the-component)

There are two ways of getting the time ago in words.

By passing `DateTime` objects:

```
$timeAgo = new Westsworld\TimeAgo();
echo $timeAgo->inWords(new DateTime("2010-01-10 23:05:00"));

```

By passing strings:

```
$timeAgo = new Westsworld\TimeAgo();
echo $timeAgo->inWordsFromStrings("2010/1/10 23:05:00");

```

Both methods give the same answer, and use the same internal logic.

Do you want the actual years, months, days, hours, minutes, seconds difference?
-------------------------------------------------------------------------------

[](#do-you-want-the-actual-years-months-days-hours-minutes-seconds-difference)

Good news for you then! I've implemented a nice little function that does just that for you. Simply do the following:

```
$timeAgo = new Westsworld\TimeAgo();
// NOTE: this is actually deprecated, since DateTime does the same. Still works though :)
$dateDifferenceArray =  $timeAgo->dateDifference("2017-03-02 07:53:00", "2017-03-02 07:53:01");

```

This will return an array with the following data:

```
[
	'years' => 0
	'months' => 0
	'days' => 0
	'hours' => 0
	'minutes' => 0
	'seconds' => 1
]

```

How to determine, what "ago" is
===============================

[](#how-to-determine-what-ago-is)

```
  0  29 secs                                                             # => less than a minute
  30 secs  1 min, 29 secs                                                # => 1 minute
  1 min, 30 secs  44 mins, 29 secs                                       # => [2..44] minutes
  44 mins, 30 secs  89 mins, 29 secs                                     # => about 1 hour
  89 mins, 29 secs  23 hrs, 59 mins, 29 secs                             # => about [2..24] hours
  23 hrs, 59 mins, 29 secs  47 hrs, 59 mins, 29 secs                     # => 1 day
  47 hrs, 59 mins, 29 secs  29 days, 23 hrs, 59 mins, 29 secs            # => [2..29] days
  29 days, 23 hrs, 59 mins, 30 secs  59 days, 23 hrs, 59 mins, 29 secs   # => about 1 month
  59 days, 23 hrs, 59 mins, 30 secs  1 yr minus 1 sec                    # => [2..12] months
  1 yr  2 yrs minus 1 secs                                               # => about 1 year
  2 yrs  max time or date                                                # => over [2..X] years

```

Changes since last version
==========================

[](#changes-since-last-version)

Lots have changed since the last version. The WWDateTime class is no longer supported. I have implemented a new class which takes a time string as parameter (and a timezone if needed), and calculates the time between them.

By request from "lsolesen" (a guy from here on github) I did removed the whole DateTime dependence thingy.

About
=====

[](#about)

Inspired by the comments at:

You should really look in to the Carbon project, it looks very nice and gives the same functionality and a lot more.

This class is here to give you the same functionality that DateTime::diff will give you.

Translations added
==================

[](#translations-added)

*Version 0.4.x was the big translations release.*

You can now translate the texts returned using the $timeAgo-&gt;inWords() or timeAgoInWords() methods. The translation is simply a language code string added to the end of the class init or timeAgoInWords() method.

Examples using the Danish translations:

```
$myLang = new \Westsworld\TimeAgo\Translations\Da();

$timeAgo = new Westsworld\TimeAgo($myLang); // default language is en (english)
echo $timeAgo->inWords("2010/1/10 23:05:00");

```

Available translation languages
===============================

[](#available-translation-languages)

You can view the file of available list inside /src/Westsworld/TimeAgo/Translations/ folder.

Changelog
=========

[](#changelog)

For a full list of changes, please see Changelog.md

Backers
=======

[](#backers)

Support us with a monthly donation and help us continue our activities. \[[Become a backer](https://opencollective.com/php-time-ago#backer)\]

[![](https://camo.githubusercontent.com/68af5ba539cfd04dcb064315b48ff78dd5202d699d93bf42f07cf9782dd2d888/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f302f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/0/website)[![](https://camo.githubusercontent.com/62bdc090473892405f7f215c0df20a7005f9ca67dae428bdc7ff5537b47fd7cd/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f312f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/1/website)[![](https://camo.githubusercontent.com/bcf359a4ed8524f52d703b628cffa2b9a37bb81ea9ade5296ea4cf30904a487b/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f322f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/2/website)[![](https://camo.githubusercontent.com/b2b33742ce205d4df098d92549ba09e8e7ca5cef0ba7bc98579bd927143d0ecc/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f332f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/3/website)[![](https://camo.githubusercontent.com/4f0a6ab20662991fc18d72cb3007e0d52db435b364a4e7713c65f4532ecc8a36/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f342f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/4/website)[![](https://camo.githubusercontent.com/4747bdb5a3a650ffd77baf1698bda335fe292c94b727b0b828e44ecfc043c5ae/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f352f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/5/website)[![](https://camo.githubusercontent.com/ec3c2039bfb2f852d8459e0ac019bde668244437f164cea83e14af934b8767b6/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f362f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/6/website)[![](https://camo.githubusercontent.com/5412bde7624b5e0988c6d78d5f46a0f2128c9a97fbfb69d5b85e2ecf4bb90495/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f372f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/7/website)[![](https://camo.githubusercontent.com/2e09f9e1d84cdcfcc98d6170d85548b0eb34802780cc232051392e8ae75ba369/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f382f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/8/website)[![](https://camo.githubusercontent.com/1fea7513a4fe83a07d80b69de6a0c542f5f088c713c838fc3da8fe5b8028b0dc/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f392f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/9/website)[![](https://camo.githubusercontent.com/2f8147ebdfb79684116eadb7991012bda7bf19ec7122a24097d5d6c3799c3c56/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f31302f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/10/website)[![](https://camo.githubusercontent.com/3c6cb92351ef007f9a621de5155d97b27adb24e8d1ec6009fbd743b5d676b7df/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f31312f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/11/website)[![](https://camo.githubusercontent.com/effa74d314bfd82bf2225617390f0dd1fec2dbfbf926f3bfee96359f2065a6ed/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f31322f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/12/website)[![](https://camo.githubusercontent.com/377d0ffabf91a304fc0c588e35e8173d8f2e7418ea17c65c906088570b24fed4/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f31332f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/13/website)[![](https://camo.githubusercontent.com/3c8bf898fd1c25e64e5db6d9e9db4f912d6bc0a06a4c37330b35ad39af6f542b/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f31342f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/14/website)[![](https://camo.githubusercontent.com/27169063bd646ec575e0743edd7c6e87440d7565a7d49b6372f7d86abcd2bced/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f31352f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/15/website)[![](https://camo.githubusercontent.com/30bdead1508c74aea18cb5254c3eb1d7e2b8159bd78b2b0820ce1951cb2e7cfd/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f31362f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/16/website)[![](https://camo.githubusercontent.com/809092debcebcc1a4f51b718f6408d4e870aa32aa4710c63f063c64a464d19a9/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f31372f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/17/website)[![](https://camo.githubusercontent.com/1e5271bbb7f95d3cbb01a0e254f4e37d8c77602e7db8baeaf9ce30311546623c/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f31382f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/18/website)[![](https://camo.githubusercontent.com/55eaa37c5494c3a18b6861f96b15683f4bc9a1fb3c8f168b173f1d7c00acc224/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f31392f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/19/website)[![](https://camo.githubusercontent.com/dee6037651c6fc637cccd65cd1f6e72d963c8a0e11a2569c6a98c0244d565815/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f32302f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/20/website)[![](https://camo.githubusercontent.com/f39e07f4a0d38b524da96dccc0a4e4a550232a7f60e9853ab1976db347559dba/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f32312f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/21/website)[![](https://camo.githubusercontent.com/5e52e8b5b0f2a8b6eecc8712f4f1c507c31a7aecefa4a154760cdb3110f69e9e/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f32322f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/22/website)[![](https://camo.githubusercontent.com/df727407e03070defa2cf3c8505ecd709e6fd0090ddd27d0f7dd389d679a2dc7/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f32332f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/23/website)[![](https://camo.githubusercontent.com/224912f4b33f6d3b816d65a5c94b16ec56acc5084bdd8100cf9bbfa1886a0327/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f32342f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/24/website)[![](https://camo.githubusercontent.com/7cfa27c7bc4c29ae9461b5df089747ca57baeb227d89f52100498d7fd3a067f6/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f32352f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/25/website)[![](https://camo.githubusercontent.com/50dae57263bd08101e6e9d683daf41024ccaf38ef8aa9ef8f1f4132a61293873/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f32362f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/26/website)[![](https://camo.githubusercontent.com/a16b5e943587990972e835809860a55c6a51408a5494b93ada2f3533d4ae7fc8/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f32372f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/27/website)[![](https://camo.githubusercontent.com/12123820e15874569969acf796667686a395ba7ecf665cee5ea19dcd5b9ce412/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f32382f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/28/website)[![](https://camo.githubusercontent.com/12f16df4460fd1e91fc2827cbd4d31b91e81a1f97117f0ac33bf20e576b7a5d2/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f6261636b65722f32392f6176617461722e737667)](https://opencollective.com/php-time-ago/backer/29/website)

Sponsors
========

[](#sponsors)

Become a sponsor and get your logo on our README on Github with a link to your site. \[[Become a sponsor](https://opencollective.com/php-time-ago#sponsor)\]

[![](https://camo.githubusercontent.com/64f55b86d3c0c11d7fa0131f1793fa43a11d1bc98e5e95373b3c0cc40b8cd808/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f302f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/0/website)[![](https://camo.githubusercontent.com/6033eb3fd41e6bbad4ad80e219ef28dfef5a6d1300a19ce30e5de1f4e94d7e2c/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f312f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/1/website)[![](https://camo.githubusercontent.com/691a3b426ec3636579376436ba4258835db716e662c9e272838ea33ae236b948/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f322f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/2/website)[![](https://camo.githubusercontent.com/c9b3edd31043757d6ade7b8103797247e10173d47a8840a3525fc10ee68e3868/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f332f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/3/website)[![](https://camo.githubusercontent.com/220406ba7b201daea444be01e6848c8f61758d4d2d50d2327b4266c28ded8dab/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f342f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/4/website)[![](https://camo.githubusercontent.com/081c1d2b79643e25bda6fb9508aa74798c4f4451c3b95073b7af5e20981a0d0a/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f352f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/5/website)[![](https://camo.githubusercontent.com/485a41762866ec98834d41f97b8bf5c89ed62d02acbf74abde1175ce82c40570/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f362f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/6/website)[![](https://camo.githubusercontent.com/57237dfc107a98cea29adb2931339beefaa8e6e1afbf263a6c8d7a435e993a1d/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f372f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/7/website)[![](https://camo.githubusercontent.com/e19e0240b549ba194d09a2bea03b27c757c895e3b9ba3e1cedcbca2eb8ef540d/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f382f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/8/website)[![](https://camo.githubusercontent.com/b6a66c0d35825b2ede769fc25a5ba35d8249e3ba793e395ab8e0c217e672ce1a/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f392f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/9/website)[![](https://camo.githubusercontent.com/bc668bb3d839cb76a80c935f1e6755e66c927c8431c31404dae03165348d85e0/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f31302f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/10/website)[![](https://camo.githubusercontent.com/1b939e49bd9968c1ad05c8bc12950123f9eeedebb37325b97f56f311874c94f8/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f31312f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/11/website)[![](https://camo.githubusercontent.com/64bcebec379dc540e5e83a50835ac865c60db4da875093fb941d698cdd045cd0/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f31322f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/12/website)[![](https://camo.githubusercontent.com/55c70b28a405e7fd8998147df2e90e2112381f86927063930d261c3c93e44f2e/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f31332f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/13/website)[![](https://camo.githubusercontent.com/6ab09ef1e0280c3331f8cd9e10a7d2d79f003faee06df11c2de037797b551f34/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f31342f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/14/website)[![](https://camo.githubusercontent.com/da3d6544d6aebfb8bbc9eb4aeb6440543d160b8e897de490223b7a0cc612f24a/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f31352f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/15/website)[![](https://camo.githubusercontent.com/a8c48e3be6c8e6a9136064a72c7e1716b5fddc6be5afb9fb90d009cdc6e4f142/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f31362f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/16/website)[![](https://camo.githubusercontent.com/553b2fd733ba438e6a604c52420f9b8ddc8d7d4e18d5e55e0469e272febf6e4a/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f31372f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/17/website)[![](https://camo.githubusercontent.com/5e9607dd3bdf165e3001a833a9f538be48e4d76c50915c8bdcf70ab7ee23980d/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f31382f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/18/website)[![](https://camo.githubusercontent.com/743b1689db41283e8a5e5365669267cc1bcd6cae5e2161660443c968889a64ac/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f31392f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/19/website)[![](https://camo.githubusercontent.com/cd43cdcee16f651d336ae58e577631ce214fd8c5b206c29f84f7b990c7106143/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f32302f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/20/website)[![](https://camo.githubusercontent.com/96470f5f8aa70b4c2a3b032e30475452dd5222b03d237c49e68a4005f5cd8eb7/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f32312f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/21/website)[![](https://camo.githubusercontent.com/5cdaaa43b2b0963be35a623c26bc018b71b17d16dd76a9357f6ad8ea26119b33/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f32322f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/22/website)[![](https://camo.githubusercontent.com/32aa32337d72317cde06e3f79cacb5e93e127f9842b1b7362b12ea1eeede6955/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f32332f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/23/website)[![](https://camo.githubusercontent.com/8997d549594491220a2839f8643e82673a0f8e03346235cf48883d334d7f68ef/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f32342f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/24/website)[![](https://camo.githubusercontent.com/36629740019aab62ae74a1efbafef12e1d5c4903a5a6de6c1ae0436b0d01da96/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f32352f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/25/website)[![](https://camo.githubusercontent.com/d8979634d23b2e5fe62e03fe8d6841b0a4f36a6e29d65182f6afebffbca4ced7/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f32362f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/26/website)[![](https://camo.githubusercontent.com/0ae4a83a0c00a096d326c0f835098e1222cd66d2e4bdae1e0e5cf38e599aa3a2/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f32372f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/27/website)[![](https://camo.githubusercontent.com/eae1b9ff7807bc4bb1f1cf081de4b9e6c7457d869b19f2618d27ecefaef167aa/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f32382f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/28/website)[![](https://camo.githubusercontent.com/4ae42d49a1fdd2e4ad6bbeb2d8568ccb2c5e9ebd4bad850c0352c175e7c2ffb9/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f7068702d74696d652d61676f2f73706f6e736f722f32392f6176617461722e737667)](https://opencollective.com/php-time-ago/sponsor/29/website)

MIT License
===========

[](#mit-license)

Copyright © 2014 Jimmi Westerberg ()

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

71

—

ExcellentBetter than 100% of packages

Maintenance83

Actively maintained with recent releases

Popularity59

Moderate usage in the ecosystem

Community40

Growing community involvement

Maturity88

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 74.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~109 days

Recently: every ~412 days

Total

40

Last Release

84d ago

Major Versions

0.4.15 → 1.0.02017-03-02

1.0.0 → 2.0.02017-03-02

2.0.5 → 3.0.02018-07-03

PHP version history (5 changes)0.3.0PHP &gt;=4

1.0.0PHP &gt;=5.6

3.1.1PHP &gt;=7.0.0

3.2.5PHP &gt;=7.1.0

3.3.0PHP &gt;=8.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/88af46c298242a40f05175d3da0628ce57a462d66eece976b48f85c6981a91ca?d=identicon)[jimmiw](/maintainers/jimmiw)

---

Top Contributors

[![jimmiw](https://avatars.githubusercontent.com/u/45835?v=4)](https://github.com/jimmiw "jimmiw (155 commits)")[![jlratwil](https://avatars.githubusercontent.com/u/2053396?v=4)](https://github.com/jlratwil "jlratwil (6 commits)")[![dhutapratama](https://avatars.githubusercontent.com/u/9693486?v=4)](https://github.com/dhutapratama "dhutapratama (5 commits)")[![killmenot](https://avatars.githubusercontent.com/u/119337?v=4)](https://github.com/killmenot "killmenot (4 commits)")[![MoPaMo](https://avatars.githubusercontent.com/u/67760881?v=4)](https://github.com/MoPaMo "MoPaMo (3 commits)")[![barohatoum](https://avatars.githubusercontent.com/u/1402924?v=4)](https://github.com/barohatoum "barohatoum (3 commits)")[![esrefesen](https://avatars.githubusercontent.com/u/13809129?v=4)](https://github.com/esrefesen "esrefesen (2 commits)")[![andersahn](https://avatars.githubusercontent.com/u/5862892?v=4)](https://github.com/andersahn "andersahn (2 commits)")[![nikopeikrishvili](https://avatars.githubusercontent.com/u/10278664?v=4)](https://github.com/nikopeikrishvili "nikopeikrishvili (2 commits)")[![fvodslon](https://avatars.githubusercontent.com/u/14891568?v=4)](https://github.com/fvodslon "fvodslon (2 commits)")[![geerteltink](https://avatars.githubusercontent.com/u/9497586?v=4)](https://github.com/geerteltink "geerteltink (2 commits)")[![baivong](https://avatars.githubusercontent.com/u/47855704?v=4)](https://github.com/baivong "baivong (2 commits)")[![akavolkol](https://avatars.githubusercontent.com/u/7072062?v=4)](https://github.com/akavolkol "akavolkol (2 commits)")[![ArthurHoaro](https://avatars.githubusercontent.com/u/1962678?v=4)](https://github.com/ArthurHoaro "ArthurHoaro (2 commits)")[![vegagame](https://avatars.githubusercontent.com/u/796184?v=4)](https://github.com/vegagame "vegagame (1 commits)")[![AJenbo](https://avatars.githubusercontent.com/u/204594?v=4)](https://github.com/AJenbo "AJenbo (1 commits)")[![zreedeecom](https://avatars.githubusercontent.com/u/391696?v=4)](https://github.com/zreedeecom "zreedeecom (1 commits)")[![cmfcmf](https://avatars.githubusercontent.com/u/2145092?v=4)](https://github.com/cmfcmf "cmfcmf (1 commits)")[![derekmd](https://avatars.githubusercontent.com/u/823566?v=4)](https://github.com/derekmd "derekmd (1 commits)")[![emadzz](https://avatars.githubusercontent.com/u/4407763?v=4)](https://github.com/emadzz "emadzz (1 commits)")

---

Tags

time agodistance of timetime ago in words

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/jimmiw-php-time-ago/health.svg)

```
[![Health](https://phpackages.com/badges/jimmiw-php-time-ago/health.svg)](https://phpackages.com/packages/jimmiw-php-time-ago)
```

###  Alternatives

[soup/paginator

Paginator is a simple class that allows you to create pagination. It doesn't require any database connection. It is compatible with Twitter's Bootstrap Framework, by using the CSS class pagination that is also attached.

351.5k](/packages/soup-paginator)[components/jquery-htmlclean

HTML Clean plug-in for jQuery

183.1k1](/packages/components-jquery-htmlclean)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
