PHPackages                             xahmedtaha/duration - 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. xahmedtaha/duration

ActiveLibrary

xahmedtaha/duration
===================

A php helper function to express time durations and convert them easily.

v1.0.1(1y ago)02MITPHPPHP ^8.0

Since Sep 14Pushed 1y ago1 watchersCompare

[ Source](https://github.com/xahmedtaha/duration)[ Packagist](https://packagist.org/packages/xahmedtaha/duration)[ Docs](https://github.com/xahmedtaha/duration)[ RSS](/packages/xahmedtaha-duration/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Duration
========

[](#duration)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e45463a630f8ce8fd9136232ae93dafa8466ee100191c7e694648f3a036d3729/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7861686d6564746168612f6475726174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/xahmedtaha/duration)[![Total Downloads](https://camo.githubusercontent.com/e56af93fd5209b228eb136895eb31bbfbd20601b52f92b8f6edbc864bf2a4ea4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7861686d6564746168612f6475726174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/xahmedtaha/duration)

A php helper function to express time durations and convert them easily.

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

[](#installation)

You can install the package via composer:

```
composer require xahmedtaha/duration
```

Usage
-----

[](#usage)

```
echo duration(hours: 2, minutes: 24)->inMilliseconds(); // 8640000
echo duration(days: 12, minutes: 24, seconds: 13, milliseconds: 15)->inSeconds(); // 18733.015
echo duration(days: 3, hours: 16)->inMinutes(); // 19680
echo duration(days: 3, hours: 2, minutes: 24)->inHours(); // 74.4
echo duration(days: 12, hours: 3, minutes: 24, seconds: 13, milliseconds: 15)->inDays(); // 12.141817
```

Credits
-------

[](#credits)

- [Ahmed Taha](https://github.com/xahmedtaha)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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 ~0 days

Total

2

Last Release

611d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0832760153cf72aa8b358edf12c0e8fae15363d9e1e9ad62729e92003215ae57?d=identicon)[xahmedtaha](/maintainers/xahmedtaha)

---

Top Contributors

[![xahmedtaha](https://avatars.githubusercontent.com/u/26720111?v=4)](https://github.com/xahmedtaha "xahmedtaha (2 commits)")

---

Tags

phptimedurationAhmed Taha

### Embed Badge

![Health badge](/badges/xahmedtaha-duration/health.svg)

```
[![Health](https://phpackages.com/badges/xahmedtaha-duration/health.svg)](https://phpackages.com/packages/xahmedtaha-duration)
```

###  Alternatives

[knplabs/knp-time-bundle

Making your dates and durations look sensible and descriptive

6308.9M39](/packages/knplabs-knp-time-bundle)[sybio/gif-frame-extractor

PHP class that separates all the frames (and their duration) of an animated GIF

179417.2k8](/packages/sybio-gif-frame-extractor)[bvanhoekelen/performance

PHP performance tool analyser your script on time, memory usage and db query. Support Laravel and Composer for web, web console and command line interfaces.

521774.3k4](/packages/bvanhoekelen-performance)[khill/php-duration

Converts between colon formatted time, human-readable time and seconds

1611.7M20](/packages/khill-php-duration)[dater/dater

Compact PHP library for working with date/time in different formats &amp; timezones.

14282.3k](/packages/dater-dater)[zjkal/time-helper

一个简单快捷的PHP日期时间助手类库。 a smart PHP datetime helper library.

21128.6k1](/packages/zjkal-time-helper)

PHPackages © 2026

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