PHPackages                             wol-soft/php-performance-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. wol-soft/php-performance-timer

ActiveLibrary

wol-soft/php-performance-timer
==============================

Provides functions to collect processing times inside your application

0.2.0(5y ago)082MITPHPPHP &gt;=7.1

Since Sep 28Pushed 5y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

[![Latest Version](https://camo.githubusercontent.com/650bbc6cd26744f24880470aeca1f6618f57ff95cb5179e9a3f11e8b08bb86b7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f776f6c2d736f66742f7068702d706572666f726d616e63652d74696d65722e737667)](https://packagist.org/packages/wol-soft/php-performance-timer)[![Minimum PHP Version](https://camo.githubusercontent.com/4c62148864d567c4ee794ffab09c1dd4a3f45e41064bbb016440beddaae71a4d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e322d3838393242462e737667)](https://php.net/)[![Maintainability](https://camo.githubusercontent.com/b9eb3949bbbb03bf62b49bb80989bb090885438b37d74ad4209541680fd54001/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f32323339626132303839323561343565353963332f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/wol-soft/php-performance-timer/maintainability)[![Test Coverage](https://camo.githubusercontent.com/54315b5e4deb89f78425c14ee482a98ddbf5487eb0b3538891f23c7a9c9147dc/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f32323339626132303839323561343565353963332f746573745f636f766572616765)](https://codeclimate.com/github/wol-soft/php-performance-timer/test_coverage)[![Build Status](https://camo.githubusercontent.com/62b4377fb5f28c767efdc78e821b5216de5791c407c6f425a443012041bcd624/68747470733a2f2f7472617669732d63692e636f6d2f776f6c2d736f66742f7068702d706572666f726d616e63652d74696d65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/wol-soft/php-performance-timer)[![Coverage Status](https://camo.githubusercontent.com/4bc139ca3f4163fabd3b11aba43ba2a0b7254f114463d961ee6bd02a2f6ce321/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f776f6c2d736f66742f7068702d706572666f726d616e63652d74696d65722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/wol-soft/php-performance-timer?branch=master)[![MIT License](https://camo.githubusercontent.com/775cfdfd11de4a55e2ea4f13955cb704d651535331104b01f311096f2e55f1a6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f776f6c2d736f66742f7068702d706572666f726d616e63652d74696d65722e737667)](https://github.com/wol-soft/php-performance-timer/blob/master/LICENSE)

php-performance-timer
=====================

[](#php-performance-timer)

Provides functions to collect processing times inside your application

Requirements
------------

[](#requirements)

- Requires at least PHP 7.1

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

[](#installation)

The recommended way to install php-json-schema-model-generator is through [Composer](http://getcomposer.org):

```
$ composer require wol-soft/php-performance-timer

```

Usage
-----

[](#usage)

To start a timer simply call the `start` method with a key. The key will be used to identify the timer:

```
Timer::start('my-timer');
```

Finish the timer with the `end` method:

```
Timer::end('my-timer');
```

By default, the timer measurements of a process will be collected and written to `/tmp/performance_timer.log` (may vary if called from apache as `sys_get_temp_dir` is used by default). If you want to fetch the results manually use `Timer::handleResults`.

The result will be a csv with the timer key and the duration between `start` and `end` (in ms):

```
my-timer,12.1324
my-timer,14.5271
my-timer,11.7832
...
```

### Namespaced timers

[](#namespaced-timers)

Each `start` and `end` method call takes an optional second parameter `$namespace`. By providing namespaces to your timers you can enable/disable measurements in specific components.

```
Timer::initSettings(['profileNamespace' => 'component.booking']);

...

Timer::start('login', 'component.user');
...
Timer::end('login', 'component.user');

...

Timer::start('check-basket', 'component.booking.init');
...
Timer::end('check-basket', 'component.booking.init');
```

Only the timers with namespaces starting with the configured namespace are executed. Timers without a namespace will always be executed. If the option `profileNamespace` is set to false no timer will be executed.

### Exceptions

[](#exceptions)

By default the timer execution may throw exceptions (eg. if a timer is started twice). If you don't want the timer to break your execution flow you can set the option `throwExceptions` to false. In this case the timer will simply ignore invalid calls.

```
Timer::initSettings(['throwExceptions' => false]);
```

### Custom data collection

[](#custom-data-collection)

To collect additional data (eg. memory consumption, start and end timestamps, ...), you can add a timer plugin:

```
Timer::addTimerPlugin($callbackStart, $callbackEnd);
```

The data returned by `$callbackStart` will be passed to `$callbackEnd`. The data returned by `$callbackEnd` will be included in the generated CSV file. By returning an array from `$callbackEnd` you can add multiple columns to the CSV.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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

Total

2

Last Release

2054d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/54dcceadd1811a5a784b80268bc53133383df11abccb1e82e8fba0e870189d7e?d=identicon)[wol-soft](/maintainers/wol-soft)

---

Top Contributors

[![wol-soft](https://avatars.githubusercontent.com/u/14750468?v=4)](https://github.com/wol-soft "wol-soft (12 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wol-soft-php-performance-timer/health.svg)

```
[![Health](https://phpackages.com/badges/wol-soft-php-performance-timer/health.svg)](https://phpackages.com/packages/wol-soft-php-performance-timer)
```

PHPackages © 2026

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