chrisdicarlo/eloquent-human-timestamps

Installs: 5 712

Dependents: 0

Suggesters: 0

Security: 0

Stars: 36

Watchers: 2

Forks: 2

Open Issues: 1

pkg:composer/chrisdicarlo/eloquent-human-timestamps

v7.0.0 2025-11-22 15:12 UTC

README

This package provides a trait you can add to an Eloquent model that will automatically create human-readable timestamp diffs using Carbon.

Latest Version on Packagist Laravel 11 Tests Total Downloads

Version Compatibility

Laravel PHP Package Version
6 8.0, 7.4, 7.3 2
7 8.0, 7.4, 7.3 2
8 8.1, 8.0, 7.4, 7.3 3
9 8.1, 8.0 4
10 8.1, 8.2, 8.3, 8.4 5
11,12 8.2, 8.3, 8.4 6.x

Installation

To install the package run:

composer require chrisdicarlo/eloquent-human-timestamps

Setup

Add the ChrisDiCarlo\EloquentHumanTimestamps\HumanTimestamps trait to a model that has timestamp columns, e.g.:


use ChrisDiCarlo\EloquentHumanTimestamps\HumanTimestamps;

class Foobar
{

    use HumanTimestamps;

   ...

}

Usage

To get the human-readable attribute, simply retrieve the timestamp normally but append _for_humans to the name, e.g. created_at_for_humans, updated_at_for_humans.