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

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

imkingdavid/load-timer
======================

1.0.1(7y ago)619MITPHPPHP &gt;=5.4.0

Since Feb 9Pushed 7y ago1 watchersCompare

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

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

LoadTimer Class
===============

[](#loadtimer-class)

A simple PHP load time measuring class. This class intends to follow the [PHP FIG Standards](http://www.php-fig.org/), so if you notice anything that is wrong, let me know and/or submit a Pull Request to fix it (see below).

Copyright (c) 2012 - David King ()

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

[](#requirements)

PHP 5.4

License
-------

[](#license)

This may be used as needed for any purpose, free or commercial with no restriction. This product is provided as is with no warranty.

Contributing
------------

[](#contributing)

If you have something to add or you see something broken, please feel free to create a ticket and/or a Pull Request. I do not have any specific guidelines for commit messages, other than that they are brief and explain exactly what is changed.

Installation &amp; Usage
------------------------

[](#installation--usage)

This repository is a Composer-enabled package. For information about installing and using Composer, check out .

Place the following code at the start of your page.

```
use imkingdavid\LoadTimer;

// If you are using Composer, you should include the composer autoload.php
// file; otherwise, include the following line:
// include('LoadTimer.php');

// Next, instantiate the class
$timer = new LoadTimer();
```

> Tip: The class does NOT automatically begin timing unless the constructor's first argument is set to true like so:
>
> ```
> ```

$timer = new LoadTimer(true);

```

If you choose not to make the timer auto-start, you will need to start it
yourself. Go to the point in your file at which you wish to begin timing, and
add the following line:
```php
$timer->start();

```

> Tip: `$timer->start()` overwrites the time at which the timer started. You can use this to your advantage, if you wish to have it begin at a different point in a script if a certain condition is met.

If you want to mark notable points in the code without ending the timer altogether, you can use the `$timer->lap()` method. It takes a single argument which is a string message that simply describes the lap. It defaults to: `Lap #` where # is the number of laps before the current one, plus one.

```
// Important code section:
$timer->lap('Before execute');
$script->execute();
$timer->lap('After execute');
```

Later, you can access all of your laps using the `$timer->laps()` method. It returns an array like so:

```
(
	[0]	=> Array
		(
			'Before execute', // Lap message
			'01234567', // Lap timestamp
		),
	[1]	=> Array
		(
			'After execute', // Lap message
			'12345678', // Lap timestamp
		)
);

```

Finally, when you want the timer to end, place the final line of code.

```
$timer->end();
```

Note that by default, the end() method *returns* the load time. You can have it echo a string *as well* by setting the first argument of end() to true. You can modify the default string that is printed by setting the second argument of end() to a string that contains %f (sprintf() is run when the string is printed).

```
$load_time = $timer->end(true, 'Page loaded in %f seconds.');
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

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

Total

2

Last Release

2726d ago

### Community

Maintainers

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

---

Top Contributors

[![imkingdavid](https://avatars.githubusercontent.com/u/217426?v=4)](https://github.com/imkingdavid "imkingdavid (23 commits)")

### Embed Badge

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

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

PHPackages © 2026

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