PHPackages                             ramphor/date-human-readable - 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. ramphor/date-human-readable

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

ramphor/date-human-readable
===========================

Generates human-readable strings for PHP DateTime objects

1.0.0(5y ago)11811MITPHPPHP &gt;=5.3.0

Since Nov 2Pushed 5y agoCompare

[ Source](https://github.com/ramphor/date-human-readable)[ Packagist](https://packagist.org/packages/ramphor/date-human-readable)[ RSS](/packages/ramphor-date-human-readable/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (1)

date-human-readable
===================

[](#date-human-readable)

Generates human-readable strings for PHP DateTime objects. It handles dates in the past and future. For future dates, it uses the format 'In x unit', ie: 'In 1 minute'. For dates in the past, it uses 'x unit ago', ie: '2 years ago'.

Note: Comparison of dates, for those beyond a day apart, uses the difference between their Unix timestamps.

Installation
------------

[](#installation)

If you're using Composer to manage dependencies, you can include the following in your composer.json file:

```
"require": {
    "ramphor/date-human-readable": "~1.0.0"
}

```

Otherwise, you can simply require the file directly:

```
require_once 'path/to/date-human-readable/src/HumanReadable.php';
```

Usage
-----

[](#usage)

```
use Ramphor\Date\HumanReadable;

HumanReadable::parse(new DateTime('now'));         // Moments ago
HumanReadable::parse(new DateTime('+ 59 second')); // Seconds from now
HumanReadable::parse(new DateTime('+ 1 minute'));  // In 1 minute
HumanReadable::parse(new DateTime('- 59 minute')); // 59 minutes ago

// You can supply a secondary argument to provide an alternate reference
// DateTime. The default is the current DateTime, ie: DateTime('now'). In
// addition, it takes into account the day of each DateTime. So in the next
// two examples, even though they're only a second apart, 'Yesterday' and
// 'Tomorrow' will be displayed

$now = new DateTime('1991-05-18 00:00:00 UTC');
$dateTime = new DateTime('1991-05-17 23:59:59 UTC');
HumanReadable::parse($dateTime, $now); // Yesterday

$now = new DateTime('1991-05-17 23:59:59 UTC');
$dateTime = new DateTime('1991-05-18 00:00:00 UTC');
HumanReadable::parse($dateTime, $now) // Tomorrow
```

Tests
-----

[](#tests)

[![Build Status](https://camo.githubusercontent.com/2d01e276d65d86db5853d818a782149605a67cdecf702edb4d13c4489e0b212d/68747470733a2f2f7472617669732d63692e6f72672f72616d70686f722f646174652d68756d616e2d7265616461626c652e706e67)](https://travis-ci.org/ramphor/date-human-readable)

From the project directory, tests can be ran using `phpunit`

License
-------

[](#license)

Released under the MIT License - see `LICENSE.txt` for details.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% 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

Unknown

Total

1

Last Release

2015d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6a609a3b3a36dee9f36ef6f8d3b2b2dc91eebefc7644031e829e65bca4329799?d=identicon)[puleeno](/maintainers/puleeno)

---

Top Contributors

[![danielstjules](https://avatars.githubusercontent.com/u/817212?v=4)](https://github.com/danielstjules "danielstjules (20 commits)")[![puleeno](https://avatars.githubusercontent.com/u/22538657?v=4)](https://github.com/puleeno "puleeno (4 commits)")[![madwings](https://avatars.githubusercontent.com/u/7276934?v=4)](https://github.com/madwings "madwings (1 commits)")

---

Tags

stringdatetimetimedatereadableprettyhuman

### Embed Badge

![Health badge](/badges/ramphor-date-human-readable/health.svg)

```
[![Health](https://phpackages.com/badges/ramphor-date-human-readable/health.svg)](https://phpackages.com/packages/ramphor-date-human-readable)
```

###  Alternatives

[danielstjules/php-pretty-datetime

Generates human-readable strings for PHP DateTime objects

5791.9k](/packages/danielstjules-php-pretty-datetime)[league/period

Time range API for PHP

7335.4M21](/packages/league-period)[brick/date-time

Date and time library

3623.3M60](/packages/brick-date-time)[aeon-php/calendar

PHP type safe, immutable calendar library

2079.7M16](/packages/aeon-php-calendar)[tplaner/when

Date/Calendar recursion library.

5261.0M5](/packages/tplaner-when)[icecave/repr

A library for generating string representations of any value, inspired by Python's reprlib library.

277.1M4](/packages/icecave-repr)

PHPackages © 2026

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