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

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

xylemical/time
==============

Provides framework for time related functionality.

04PHP

Since Jul 4Pushed 3y ago1 watchersCompare

[ Source](https://github.com/xylemical/time)[ Packagist](https://packagist.org/packages/xylemical/time)[ RSS](/packages/xylemical-time/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Time
====

[](#time)

Provides framework for time related functionality.

Install
-------

[](#install)

The recommended way to install this library is [through composer](http://getcomposer.org).

```
composer require xylemical/time
```

Usage
-----

[](#usage)

The framework provides clocks, micro-clocks, current time and timers.

### Clocks

[](#clocks)

Clocks are a named fixed point in time in seconds.

#### Usage

[](#usage-1)

```
use Xylemical\Time\Clock;

$clock = new Clock('name'); // Defaults to current time.
$clock->setTimestamp(strtotime('+1 month')); // Changes the timestamp to one month from now.

$clock = new Clock('name', strtotime('+1 day')); // Clock has timestamp for +1 day.
```

### Micro-Clocks

[](#micro-clocks)

Micro-clocks are a named fixed point in time in microseconds.

#### Usage

[](#usage-2)

```
use Xylemical\Time\MicroClock;

$clock = new MicroClock('name'); // Defaults to current microtime.
$clock->setTime(microtime(TRUE)); // Changes the time to the current microtime.

$clock = new MicroClock('name', microtime(TRUE)); // Clock has current microtime.
```

### Timers

[](#timers)

Timers are a named stopwatch using microtime.

#### Usage

[](#usage-3)

```
use Xylemical\Time\Timer;

$timer = new Timer('name'); // Timers are not started by default.
$timer->start();            // Starts the timer.
$timer->stop();             // Stops the timer.

echo $timer->getTime();         // Current the time as microtime.
echo $timer->getSeconds();      // Get the seconds for the timer.
echo $timer->getMicroseconds(); // Get the microseconds for the timer.

$timer->reset(); // R

$clock = new MicroClock('name', microtime(TRUE)); // Clock has current microtime.
```

License
-------

[](#license)

MIT, see LICENSE.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity26

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6a6f5fc80d04ffca782072d391a679cd679265cf62959fb6f67749f6063199eb?d=identicon)[rhys-mcguckin](/maintainers/rhys-mcguckin)

---

Top Contributors

[![rhys-mcguckin](https://avatars.githubusercontent.com/u/5679170?v=4)](https://github.com/rhys-mcguckin "rhys-mcguckin (4 commits)")

### Embed Badge

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

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

PHPackages © 2026

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