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

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

nullform/app-timer
==================

Timer with nested intervals, execution time measurement

v2.1.0(2y ago)143MITPHPPHP &gt;=7.1CI failing

Since Mar 17Pushed 2y ago1 watchersCompare

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

READMEChangelogDependencies (1)Versions (7)Used By (0)

AppTimer
========

[](#apptimer)

Timer for PHP apps with nested intervals.

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

[](#installation)

```
composer require nullform/app-timer

```

Usage
-----

[](#usage)

### Basic usage

[](#basic-usage)

```
use Nullform\AppTimer;

$timer = new AppTimer\Timer("New timer");

$timer->start("First interval");
// Some code...
$interval = $timer->stop(); // Instance of Interval

$timer->start("Second interval");
// Some code...
$duration = $timer->stop()->duration; // float

$report = $timer->report(); // Instance of Report
```

### Nested intervals

[](#nested-intervals)

You can create new (nested) intervals within others.

```
$timer->start("First interval"); // Parent interval

$timer->start("First nested interval");
// Some code...
$timet->stop(); // Stop first nested interval

$timer->start("Second nested interval");
// Some code...
$timet->stop(); // Stop second nested interval

$timer->stop(); // Stop parent interval

$report = $timer->report(); // Instance of Report
```

### Additional information for timer/interval

[](#additional-information-for-timerinterval)

You can add additional information for the timer/interval to be reflected in the report.

```
$timer = new AppTimer\Timer("New timer", ['Size' => "XXL"]);
$timer->start("New interval", ['Color' => "Red"]);
```

### Report

[](#report)

The report can be generated as a human-readable string or in JSON format. You can save the report to a file.

```
// Create new timer
$timer = new AppTimer\Timer("New timer");

// Report file options
$timer->report_filename = "AppTimerReport.log";
$timer->report_dir = dirname(__FILE__);
$timer->report_file_append = true;

$timer->start("New interval");
// ...
$timer->stop();

// Create report
$report = $timer->report(); // Instance of Report

$report_json = $report->toJSON();
$report_string = $report->toString();
```

Methods
-------

[](#methods)

### Timer

[](#timer)

- Timer::**\_\_construct**(*string* $description = "", *array* $extras = \[\])
- Timer::**start**(*string* $description, *array* $extras = \[\]): *Interval*
- Timer::**stop**(*array* $extras = \[\]): *?Interval*
- Timer::**stopAll**(): *void*
- Timer::**report**(): *Report*

### Interval

[](#interval)

- Interval::**extras**(): *Extras*

### Extras

[](#extras)

- Extras::**add**(*string* $key, *string* $value): *int*
- Extras::**remove**(*string* $key): *int*
- Extras::**get**(): *array*
- Extras::**getOne**(*string* $key): *?string*

### Report

[](#report-1)

- Report::**longestInterval**(): *?Interval*
- Report::**toString**(): *string*
- Report::**toJSON**(): *string*
- Report::**extras**(): *Extras*

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

Recently: every ~431 days

Total

6

Last Release

802d ago

Major Versions

v1.0.1 → v2.0.02019-11-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/04a9894c87cf7ea2b58fc41be2ebbb1a999e1906d209e146b0fc2fd9dd9b7b2e?d=identicon)[nullform](/maintainers/nullform)

---

Top Contributors

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

---

Tags

measurementphptimertimetimermeasurementintervalsmicrotime

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[symfony/clock

Decouples applications from the system clock

430168.9M205](/packages/symfony-clock)[knplabs/knp-time-bundle

Making your dates and durations look sensible and descriptive

6308.9M39](/packages/knplabs-knp-time-bundle)[league/period

Time range API for PHP

7335.4M21](/packages/league-period)[brick/date-time

Date and time library

3623.3M61](/packages/brick-date-time)[aeon-php/calendar

PHP type safe, immutable calendar library

2079.7M16](/packages/aeon-php-calendar)[kartik-v/yii2-date-range

An advanced Yii 2 date range picker input for based on bootstrap-daterangepicker plugin.

894.4M42](/packages/kartik-v-yii2-date-range)

PHPackages © 2026

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