PHPackages                             bakame/tokei - 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. bakame/tokei

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

bakame/tokei
============

Immutable value objects for expressive temporal modeling: time, duration, circular 24-hour intervals, and interval sets, without timezone handling.

0.1.0(1mo ago)810↓80%MITPHPPHP ^8.3.0CI passing

Since May 27Pushed 1mo agoCompare

[ Source](https://github.com/bakame-php/tokei)[ Packagist](https://packagist.org/packages/bakame/tokei)[ Docs](https://github.com/bakame-php/tokei)[ GitHub Sponsors](https://github.com/sponsors/nyamsprod)[ RSS](/packages/bakame-tokei/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (1)Dependencies (7)Versions (2)Used By (0)

[![tokei](.github/tokei-logo.jpg?raw=true)](.github/tokei-logo.jpg?raw=true)

Tokei
=====

[](#tokei)

[![Author](https://camo.githubusercontent.com/8227017ba73e8c0c93fa2c9c653cf702644a5af5d422e7f612b31d45efc180a1/687474703a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d406e79616d7370726f642d626c75652e7376673f7374796c653d666c61742d737175617265)](https://phpc.social/@nyamsprodd)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build](https://github.com/bakame-php/tokei/workflows/build/badge.svg)](https://github.com/bakame-php/tokei/actions?query=workflow%3A%22build%22)[![Latest Version](https://camo.githubusercontent.com/326c3b769e13ce61db81bb44063403dd228972bb52184ca6ebea657a2404ff55/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f62616b616d652d7068702f746f6b65692e7376673f7374796c653d666c61742d737175617265)](https://github.com/bakame-php/tokei/releases)[![Total Downloads](https://camo.githubusercontent.com/ddfbeae2a2d4b7901d8ea4a83bf6c24d98f4ac74fb570420e02ad61f9c6d63d4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f62616b616d652f746f6b65692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bakame/tokei)[![Sponsor development of this project](https://camo.githubusercontent.com/2e662697b46a37233abdd7e45373397aab0bd5206336533151cdf42455d81048/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73706f6e736f72253230746869732532307061636b6167652d2545322539442541342d6666363962342e7376673f7374796c653d666c61742d737175617265)](https://github.com/sponsors/nyamsprod)

**Tokei** (pronounced: \[to̞ke̞ː\] or \[tokeː\]) is a lightweight domain-focused set of immutable value objects for representing and operating on time, durations, including, circular 24-hour intervals, and interval sets, offering expressive temporal modeling without timezone handling.

The framework-agnostic package offers a consistent and expressive way to work with temporal values in a safe and predictable manner.

```
use Bakame\Tokei\Duration;
use Bakame\Tokei\DurationFormat;
use Bakame\Tokei\Time;

$target = Duration::of(hours: 7, minutes: 33);
$alreadyDone = Duration::of(hours: 5, minutes: 17);
$remaining = $target->sum($alreadyDone->negated());
$startedNewShiftAt = Time::at(hour: 21, minute: 31);
$shouldStopAt = $startedNewShiftAt->shift($remaining);

echo "I have to work ", $target->format(DurationFormat::Compact), " today", PHP_EOL;
echo "I have already worked for ", $alreadyDone->format(DurationFormat::Compact), PHP_EOL;
echo "I still have to work ", $remaining->format(DurationFormat::Compact), PHP_EOL;
echo "If I start working again at ", $startedNewShiftAt->format(), PHP_EOL;
echo "I will end today's shit at ", $shouldStopAt->format(), PHP_EOL;

// Gives the following:

/**
 * I have to work 7h33m today
 * I have already worked for 5h17m
 * I still have to work 2h16m
 * If I start working again at 21:31:00
 * I will end today's shit at 23:47:00
 */
```

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

[](#installation)

```
composer require bakame/tokei

```

You need:

- **PHP &gt;= 8.4** but the latest stable version of PHP is recommended
- **The library does not support 32bit PHP**
- to be able to get the locale string version of the time you need the `ext-intl` extension or use a polyfill for `IntlDateFormatter`.

Documentation
-------------

[](#documentation)

Full documentation can be found at [https://bakame-php.github.io/tokei](//bakame-php.github.io/tokei)

Testing
-------

[](#testing)

The library has:

- a [PHPUnit](https://phpunit.de) test suite.
- a coding style compliance test suite using [PHP CS Fixer](https://cs.symfony.com/).
- a code analysis compliance test suite using [PHPStan](https://github.com/phpstan/phpstan).

To run the tests, run the following command from the project folder.

```
composer test
```

Contributing
------------

[](#contributing)

Contributions are welcome and will be fully credited. Please see [CONTRIBUTING](.github/CONTRIBUTING.md) and [CONDUCT](.github/CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [ignace nyamagana butera](https://github.com/nyamsprod)
- [All Contributors](https://github.com/bakame-php/tokei/graphs/contributors)

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance91

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

58d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/51073?v=4)[Ignace Nyamagana Butera](/maintainers/nyamsprod)[@nyamsprod](https://github.com/nyamsprod)

---

Top Contributors

[![nyamsprod](https://avatars.githubusercontent.com/u/51073?v=4)](https://github.com/nyamsprod "nyamsprod (47 commits)")

---

Tags

business-hourscircular-rangecircular-timedatedatetimedurationintervallocaltimemicrosecondsclocktimearithmeticcomparisonintervalimmutableuniondurationprecisionnormalizationdeterministictemporalLocalTimealgebraiso8601differenceiterationtruncationmicrosecondsintersectiontime-of-dayiso80000circular ranges

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/bakame-tokei/health.svg)

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

###  Alternatives

[brick/date-time

Date and time library

3663.8M112](/packages/brick-date-time)[symfony/clock

Decouples applications from the system clock

433205.7M428](/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)[aeon-php/calendar

PHP type safe, immutable calendar library

20810.4M16](/packages/aeon-php-calendar)[khill/php-duration

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

1571.8M21](/packages/khill-php-duration)

PHPackages © 2026

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