PHPackages                             magroski/time-buddy - 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. magroski/time-buddy

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

magroski/time-buddy
===================

A library to handle time and date interval

v1.0.2(3y ago)019.0k↓40%MITPHPPHP ^7.1 || ^8

Since May 15Pushed 3y ago1 watchersCompare

[ Source](https://github.com/magroski/time-buddy)[ Packagist](https://packagist.org/packages/magroski/time-buddy)[ RSS](/packages/magroski-time-buddy/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (6)Versions (4)Used By (0)

Time Buddy
==========

[](#time-buddy)

[![Latest Stable Version](https://camo.githubusercontent.com/9b7bccece8246dbe8d1b991ab93190b5c1f664fec5a3cfdda1e68cae6e7d8465/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6167726f736b692f74696d652d62756464792e7376673f7374796c653d666c6174)](https://packagist.org/packages/magroski/time-buddy)[![Minimum PHP Version](https://camo.githubusercontent.com/7a09b828563f7738e2e72ec4aade8144538bf5d41e1e2e718815c57e3416089f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e312d3838393242462e7376673f7374796c653d666c6174)](https://php.net/)[![CircleCI](https://camo.githubusercontent.com/a7c3afe8cdf23c1076fbbd33f2bd1e04a97b054b8258b7694e003a6a52fcc220/68747470733a2f2f636972636c6563692e636f6d2f67682f6d6167726f736b692f74696d652d62756464792e7376673f7374796c653d736869656c64)](https://circleci.com/gh/magroski/time-buddy)[![GitHub license](https://camo.githubusercontent.com/f48f8d6cf609f5b181b9c3218a85175fe8a5809c7ea400347f39697a5d55065d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c6174)](https://github.com/magroski/time-buddy/blob/master/LICENSE)

This library provides some syntax sugar around time and date manipulation, including on-the-fly format localization without the need to add multiple locales to your environment.

Locales are available on the folder `src/Provider`. Pull-requests are welcome.

Usage examples
--------------

[](#usage-examples)

Creation

```
# Default
$time = new Time();

# From unix timestamp
$time = Time::createFromUnixTstamp(time());

# From DateTime
$dateTime = new \DateTime();
$time = Time::createFromDateTime($dateTime);

# From DateTimeImmutable
$immutable = new \DateTimeImmutable();
$time = new Time($immutable);
```

Operations (Time is immutable, so operations generate new objects)

```
$firstTime = new Time();

$secondTime = $firstTime->add(100);

$thirdTime = $firstTime->subtract(100);
```

Formatting

```
$time = new Time();
$time->format('d F Y'); # 20 May 2019

$time->setLocale('pt_BR');
$time->format('d F Y'); # 20 Maio 2019
```

Generating a Date Interval

```
$time = new Time();
$laterTime = new Time();

# From Time
$interval = $time->diff($laterTime);

# Staticaly
$interval = DateInterval::createFromTime($time, $laterTime);

# Staticaly from a single time
$interval = DateInterval::createFromTime($time); # Second argument is current time
```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~647 days

Total

3

Last Release

1313d ago

PHP version history (2 changes)v1.0.0PHP ^7.1

v1.0.2PHP ^7.1 || ^8

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2437681?v=4)[Lucas Magroski](/maintainers/magroski)[@magroski](https://github.com/magroski)

---

Top Contributors

[![magroski](https://avatars.githubusercontent.com/u/2437681?v=4)](https://github.com/magroski "magroski (9 commits)")

---

Tags

timedate-interval

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/magroski-time-buddy/health.svg)

```
[![Health](https://phpackages.com/badges/magroski-time-buddy/health.svg)](https://phpackages.com/packages/magroski-time-buddy)
```

###  Alternatives

[symfony/clock

Decouples applications from the system clock

436205.7M391](/packages/symfony-clock)[knplabs/knp-time-bundle

Making your dates and durations look sensible and descriptive

6339.5M56](/packages/knplabs-knp-time-bundle)[league/period

Time range API for PHP

7335.8M24](/packages/league-period)[wapmorgan/morphos

A morphological solution for Russian and English language written completely in PHP. Provides classes to inflect personal names, geographical names, decline and pluralize nouns, generate cardinal and ordinal numerals, spell out money amounts and time.

8351.4M7](/packages/wapmorgan-morphos)[brick/date-time

Date and time library

3663.8M108](/packages/brick-date-time)[aeon-php/calendar

PHP type safe, immutable calendar library

20810.4M16](/packages/aeon-php-calendar)

PHPackages © 2026

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