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

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

innmind/time
============

Time manipulation

1.1.0(3w ago)013.1k↓64.8%13MITPHPPHP ~8.4CI passing

Since Jan 17Pushed 3w ago1 watchersCompare

[ Source](https://github.com/Innmind/time)[ Packagist](https://packagist.org/packages/innmind/time)[ Docs](http://github.com/innmind/time)[ RSS](/packages/innmind-time/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (10)Versions (4)Used By (13)

Time
====

[](#time)

[![Build Status](https://github.com/Innmind/time/actions/workflows/ci.yml/badge.svg)](https://github.com/Innmind/time/actions/workflows/ci.yml)[![codecov](https://camo.githubusercontent.com/ec31b272096a66369cc10b50ac7e124b4305ad61b4e2bdbef68526e0b50e4c15/68747470733a2f2f636f6465636f762e696f2f67682f696e6e6d696e642f74696d652f6272616e63682f646576656c6f702f67726170682f62616467652e737667)](https://codecov.io/gh/innmind/time)[![Type Coverage](https://camo.githubusercontent.com/b33bdf5ba4fd353d62a94f26aa9357a080e490e499cb96233362e4fa009e341b/68747470733a2f2f73686570686572642e6465762f6769746875622f696e6e6d696e642f74696d652f636f7665726167652e737667)](https://shepherd.dev/github/innmind/time)

This library allows you to handle time down to the millisecond. The point was to also be explicit for every component of dates, this is why every php *magic strings* have been converted into objects.

**All objects are immutable.**

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

[](#installation)

```
composer require innmind/time
```

Usage
-----

[](#usage)

### Accessing time

[](#accessing-time)

```
use Innmind\Time\{
    Clock,
    Point,
    Format,
};
use Innmind\Immutable\Attempt;

$clock = Clock::live();
$now = $clock->now(); // return an instance of Point
echo $now->toString(); // 2016-10-11T12:17:30.123456+02:00

$epoch = $clock->at(
    '1970-01-01T00:00:00.000000+00:00',
    Format::iso8601(),
); // Attempt
```

Here we reference 2 points in time, the first is the exact moment we call `now` down to the microsecond and the second one is the epoch time.

The method `at()` accepts any string that is allowed by `\DateTimeImmutable`.

### Halt process

[](#halt-process)

```
use Innmind\Time\{
    Halt
    Period,
};

function yourApp(Halt $halt): void
{
    // do something
    $halt(Period::minute(42))->unwrap();
    // do some more
}

yourApp(Halt::new());
```

This example will halt your program for 42 minutes.

#### Logging

[](#logging)

```
use Innmind\Time\Halt;
use Psr\Log\LoggerInterface;

$halt = Halt::logger($halt, /** an instance of LoggerInterface */);

## Documentation

Full documentation is available at .
```

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance94

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity54

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

Total

2

Last Release

26d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/851425?v=4)[Baptiste Langlade](/maintainers/Baptouuuu)[@Baptouuuu](https://github.com/Baptouuuu)

---

Top Contributors

[![Baptouuuu](https://avatars.githubusercontent.com/u/851425?v=4)](https://github.com/Baptouuuu "Baptouuuu (20 commits)")

---

Tags

clockhalttimeclocktimesleep

### Embed Badge

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

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

###  Alternatives

[symfony/clock

Decouples applications from the system clock

432192.7M336](/packages/symfony-clock)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

562565.8k41](/packages/ecotone-ecotone)[icecave/chrono

A date &amp; time library that is decoupled from the system clock.

56193.6k7](/packages/icecave-chrono)

PHPackages © 2026

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