PHPackages                             justlunix/timer - 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. justlunix/timer

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

justlunix/timer
===============

A tool to track execution times of tasks

v1.0.0(2y ago)04PHP

Since Oct 14Pushed 2y ago1 watchersCompare

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

READMEChangelogDependencies (3)Versions (2)Used By (0)

Timer
=====

[](#timer)

A simple tool to track execution times of tasks.

### Install

[](#install)

Simply install the package via composer and you're good to go!

```
composer require justlunix/timer
```

### Usage

[](#usage)

#### Simple tracking of a task

[](#simple-tracking-of-a-task)

```
$task = Timer::task('Fetching Customer Data From API', function() {
    // fetching...
});

echo $task->getTaskData()->getReadableTimeRun(); // => 2sec 15ms
```

#### Nested task tracking

[](#nested-task-tracking)

```
$task = Timer::task('Handling Web Request', function(TaskData $taskData) {
    $apiTask = Timer::task('Fetching Customer Data From API', function() {
        // fetching...
    }, parent: $taskData);
    $resTask = Timer::task('Building Response', function() use ($apiTask) {
        // building...
    }, parent: $taskData);

    return $resTask->result;
});
```

#### Subscribe to events

[](#subscribe-to-events)

```
Timer::subscribe(
    PostTaskExecutedEvent::class,
    function (TaskData $taskData) {
        // do something
    }
);
```

#### Compare tasks

[](#compare-tasks)

```
$issetTestTask = Timer::task('isset() performance', function () {
    // Implement performance test
});
$arraySearchTestTask = Timer::task('array_search() performance', function () {
    // Implement performance test
});

$taskComparison = Timer::compare($issetTestTask->getTaskData(), $arraySearchTestTask->getTaskData());
```

#### Cache task results

[](#cache-task-results)

```
// Invalidate caches via
Timer::$invalidateCaches = true;

$task = Timer::task('Fetching Customer Data From API', function() {
    // fetching...
}, cacheUntil: new \DateTime('tomorrow'));

$task = Timer::task('Fetching Customer Data From API', function() {
    // fetching...
}); // => Cache hit!
```

#### Export statistics

[](#export-statistics)

```
// Export all tasks at the end with
Timer::exportAsFile(__DIR__ . '/timer.txt');

// TODO: or enable live logging into a file
Timer::enableLiveLogging(__DIR__ . '/timer.txt');

// TODO: or log to Spatie Ray!
Timer::enableRay();
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

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

Unknown

Total

1

Last Release

947d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ab48240100d3d920e23b6328543a1165c4c4103f770d901930413b40b226693f?d=identicon)[justlunix](/maintainers/justlunix)

---

Top Contributors

[![justlunix](https://avatars.githubusercontent.com/u/66276367?v=4)](https://github.com/justlunix "justlunix (12 commits)")

### Embed Badge

![Health badge](/badges/justlunix-timer/health.svg)

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

###  Alternatives

[spatie/laravel-analytics

A Laravel package to retrieve Google Analytics data.

3.2k5.7M57](/packages/spatie-laravel-analytics)[fisharebest/webtrees

webtrees online genealogy

73710.5k13](/packages/fisharebest-webtrees)[intervention/zodiac

Zodiac Sign Calculator

58191.7k](/packages/intervention-zodiac)[erlandmuchasaj/laravel-gzip

Gzip your responses.

40129.3k2](/packages/erlandmuchasaj-laravel-gzip)

PHPackages © 2026

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