PHPackages                             pavel-krush/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. pavel-krush/duration

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

pavel-krush/duration
====================

PHP implementation of GoLang time.Duration

v1.0.0(5y ago)11.7k↓21.4%MITPHP

Since Sep 29Pushed 5y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (3)Used By (0)

Duration
========

[](#duration)

PHP implementation of GoLang's time.Duration

The code is mostly ported from GoLang source code. See time/format.go and time/time.go

Setup
-----

[](#setup)

Ensure you have composer installed, then run the following command:

```
composer require pavel-krush/duration
```

That will fetch the library inside your vendor folder. Then you can add the following to your .php files in order to use the library:

```
require_once __DIR__.'/vendor/autoload.php';
```

Usage
-----

[](#usage)

To parse string containing duration use Parser class:

```
$d = \PavelKrush\Duration\Parser::fromString("13h10m21s");
print $d->Hours() . "\n"; // 13.345
print $d->Minutes() . "\n"; // 790.7
print $d->Seconds() . "\n"; // 47421
print $d->Round(new \PavelKrush\Duration\Duration(\PavelKrush\Duration\Duration::Minute)); // 13h10m0s
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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

2057d ago

Major Versions

v0.1.0 → v1.0.02020-09-29

### Community

Maintainers

![](https://www.gravatar.com/avatar/bee1ea98be19cf4df1cf9eed81ab4f7886fe80d4b872c531ca0ce528fc5ef92e?d=identicon)[pavel-krush](/maintainers/pavel-krush)

---

Top Contributors

[![pavel-krush](https://avatars.githubusercontent.com/u/2105122?v=4)](https://github.com/pavel-krush "pavel-krush (5 commits)")

### Embed Badge

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

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

###  Alternatives

[symbiote/silverstripe-advancedworkflow

Adds configurable workflow support to the CMS, with a GUI for creating custom workflow definitions.

46295.2k7](/packages/symbiote-silverstripe-advancedworkflow)[fidum/nova-package-bundler-command

Improves Laravel Nova initial load speeds by combining all third party package assets into a single file.

2164.8k](/packages/fidum-nova-package-bundler-command)

PHPackages © 2026

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