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

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

alexpw/timer
============

0.0.1(11y ago)0261PHPPHP &gt;=5.3.0

Since Sep 13Pushed 11y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (2)Used By (1)

Timer
=====

[](#timer)

A quick to write and easy to use PHP timer for benchmarking.

### Usage

[](#usage)

```
require 'vendor/autoload.php';

use Alexpw\Timer\Timer;

$t = new Timer;

$max = 500000;
$xs  = range(1, $max);
$odd = function ($x) {
    return $x % 2 === 1;
};
function isOdd($x) {
	return $x % 2 === 1;
}
$rs  = array();

$run = $t->start("odd? control");

foreach ($xs as $x) {
    if ($x % 2 === 1) {
        $rs[] = $x;
    }
}
$t->end($run);

$rs  = array(); // use the gap between runs to teardown/setup

$run = $t->start("odd? closure");

foreach ($xs as $x) {
    if ($odd($x)) {
        $rs[] = $x;
    }
}
$t->end($run);

$rs  = array();
$run = $t->start("odd? function");

foreach ($xs as $x) {
    if (isOdd($x)) {
        $rs[] = $x;
    }
}
$t->end($run);

$rs  = array();
$run = $t->start("odd? array_filter closure");
$rs = array_filter($xs, $odd);
$t->end($run);

$rs  = array();
$run = $t->start("odd? array_filter function");
$rs = array_filter($xs, 'isOdd');
$t->end($run);

unset($rs);

echo $t->render();
```

### Example Output

[](#example-output)

```
   label                                   time (ms)   perc           mem
------------------------------------------------------------------------------
   odd? control                            71.5       11.90      22.98 MB
   odd? closure                            131.3      21.85      22.98 MB
   odd? function                           123.9      20.62      22.98 MB
   odd? array_filter closure               125.9      20.95      22.98 MB
   odd? array_filter function              151.6      25.22      22.98 MB
------------------------------------------------------------------------------

```

The tim

### License

[](#license)

Licensed under the MIT License - see the LICENSE file for details

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

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

4264d ago

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[grasmash/composerize-drupal

Convert a non-Composer managed Drupal application into a Composer-managed application.

12819.4k1](/packages/grasmash-composerize-drupal)[neutron/signal-handler

A library to ease the use of signal handling.

13101.4k2](/packages/neutron-signal-handler)

PHPackages © 2026

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