PHPackages                             disfasia/php-timing - 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. disfasia/php-timing

ActiveLibrary

disfasia/php-timing
===================

Get execution times of a full script or parts of it

v0.0.2(4y ago)2294PHPPHP &gt;=5.3.3

Since Oct 22Pushed 4y ago2 watchersCompare

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

READMEChangelog (1)DependenciesVersions (2)Used By (0)

PHP-Timing
==========

[](#php-timing)

A simple static class to dissect execution times of a full script or parts of it.

Getting Started
---------------

[](#getting-started)

Include `Timing.php` via `include`, `require` or `composer autoload` and use it as a static class.

Methods
-------

[](#methods)

### Timing:: start('name') / stop('name')

[](#timing-startname--stopname)

Calculate the execution time between two points.

```
Timing::start('random calc');
for ($i = 0; $i < 10000; $i++) {
    $r = rand();
}
Timing::stop('random calc');

```

### Timing:: break

[](#timing-break)

Saves the time elapsed since the script started to the break point

```
$var = rand();
sleep(2);

Timing::break();

$var = rand();

```

### Timing:: measure('name', callback)

[](#timing-measurename-callback)

Calculate the execution time of a function

```
$returnVal = 0;
for ($i = 1; $i < 3; $i++) {
    $returnVal += Timing::measure('someFunction('.$i.')', function() use ($i) {
        sleep($i);
        return $i;
    });
}
var_dump($returnVal);

```

### Timing:: addCallback( callback )

[](#timing-addcallback-callback-)

Adds a function called every time a new timing has been saved

```
Timing::addCallback(function($key, $time) {
    var_dump("Collected timing for: $key: ". round($time,4));
});

```

### Timing:: getTimings($round = 3, $slowThreshold = -INF, callable $cb )

[](#timing-gettimingsround--3-slowthreshold---inf-callable-cb-)

Returns all saved times under a key=&gt;value array

```
Array
(
    [start] => 0
    [random calc] => 0.0003
    [someFunction(1)] => 1.0001
    [break @ sample.php:45] => 1.0006
    [someFunction(2)] => 2.0001
)

```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity35

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

1659d ago

### Community

Maintainers

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

---

Top Contributors

[![darioguarascio](https://avatars.githubusercontent.com/u/3661363?v=4)](https://github.com/darioguarascio "darioguarascio (1 commits)")

### Embed Badge

![Health badge](/badges/disfasia-php-timing/health.svg)

```
[![Health](https://phpackages.com/badges/disfasia-php-timing/health.svg)](https://phpackages.com/packages/disfasia-php-timing)
```

PHPackages © 2026

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