Download the PHP package nyomanjyotisa/human-readable-time-diff without Composer
On this page you can find all versions of the php package nyomanjyotisa/human-readable-time-diff. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nyomanjyotisa/human-readable-time-diff
More information about nyomanjyotisa/human-readable-time-diff
Files in nyomanjyotisa/human-readable-time-diff
Package human-readable-time-diff
Short Description A PHP package for converting timestamps into human-readable time differences
License MIT
Informations about the package human-readable-time-diff
Human Readable Time Difference
A PHP package for converting timestamps into human-readable time differences (e.g., "2 minutes ago", "3 hours ago", "1 day ago").
Requirements
- PHP 7.4 or higher
Installation
Usage
Basic Usage
Using a Custom Reference Time
Using Different Languages
The package supports multiple languages out of the box:
Supported Languages
The package supports 50+ locale codes. You can call TranslationConfig::getAvailableLocales() to retrieve the full list. Some examples include:
- en, id, es, fr, de, it, pt, ru, zh, ja, ko
- ar, hi, bn, tr, nl, pl, uk, vi, th, ms
- fa, ur, pa, gu, ta, te, kn, ml, mr, or, as
- ne, si, my, km, lo, bo, dz, ug, kk, ky, uz, tk
- az, ka, hy, he, yi, am, ti, om, so, sw, zu
- xh, st, tn, ts, ss, nr, nd, ve
For the complete list, refer to TranslationConfig::getAvailableLocales().
Creating Custom Formatters
You can create custom formatters by implementing the TimeFormatterInterface:
Testing
License
This package is licensed under the MIT License.
Hire the Author
Nyoman Jyotisa is a senior developer (PHP, JS, TS, Laravel, ReactJS, React Native, Next.js). Hire me at $20/hour.
Email: [email protected]