PHPackages                             joomla/profiler - 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. [Framework](/categories/framework)
4. /
5. joomla/profiler

ActiveJoomla-package[Framework](/categories/framework)

joomla/profiler
===============

Joomla Profiler Package

4.0.0(9mo ago)69.9k4GPL-2.0-or-laterPHPPHP ^8.3.0CI passing

Since Jun 4Pushed 9mo ago11 watchersCompare

[ Source](https://github.com/joomla-framework/profiler)[ Packagist](https://packagist.org/packages/joomla/profiler)[ Docs](https://github.com/joomla-framework/profiler)[ RSS](/packages/joomla-profiler/feed)WikiDiscussions 3.x-dev Synced 1mo ago

READMEChangelog (6)Dependencies (5)Versions (20)Used By (0)

The Profiler Package [![Build Status](https://github.com/joomla-framework/profiler/actions/workflows/ci.yml/badge.svg?branch=3.x-dev)](https://github.com/joomla-framework/profiler)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#the-profiler-package-)

[![Latest Stable Version](https://camo.githubusercontent.com/716b8866768295b5a1e72b478678f11437cabab1f06da1c9edf29d8ecb80dde6/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6f6d6c612f70726f66696c65722f762f737461626c65)](https://packagist.org/packages/joomla/profiler)[![Total Downloads](https://camo.githubusercontent.com/6076ffb37e491b0b9e8ccfaf07ea8378940322328929308784a4804b399fcff8/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6f6d6c612f70726f66696c65722f646f776e6c6f616473)](https://packagist.org/packages/joomla/profiler)[![Latest Unstable Version](https://camo.githubusercontent.com/3bc5dba47cfc4819205fcd7cdf791aaa12b1f9f9d8f280b4c918611d245dfe23/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6f6d6c612f70726f66696c65722f762f756e737461626c65)](https://packagist.org/packages/joomla/profiler)[![License](https://camo.githubusercontent.com/9c3dec659f7370b7aeb7db5b50faea9f5a939e4ce4e425c118ac2ee7b927dc05/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6f6d6c612f70726f66696c65722f6c6963656e7365)](https://packagist.org/packages/joomla/profiler)

The Joomla Framework provides you a Profiler to profile the time that it takes to do certain tasks or reach various milestones as your extension runs.

### Usage

[](#usage)

```
use Joomla\Profiler\Profiler;

// Creating a Profiler having the name "Notes".
$profiler = new Profiler('Notes');

// Mark a point called "Start".
$profiler->mark('Start');

// Execute some code...

// Mark a point called "Middle".
$profiler->mark('Middle');

// Execute some code...

// Mark a point called "End".
$profiler->mark('End');
```

You must at least mark the first point which will be the reference.

Now, you can retrieve the elapsed time between two points :

```
use Joomla\Profiler\Profiler;

// Return the elapsed time in seconds between two points (the order does not matter).
$elapsed = $profiler->getTimeBetween('Start', 'Middle');
```

You can also retrieve the amount of allocated memory between two points.

```
use Joomla\Profiler\Profiler;

// Return the amount of allocated memory between these two points.
$elapsed = $profiler->getMemoryBytesBetween('Start', 'Middle');
```

When you have finished, you can output the result.

```
// Will display the profiler results.
echo $profiler;

// Will render the profiler as a string.
$render = $profiler->render();
```

The output could look something like the following:

```
Notes 0.000 seconds (+0.000); 0.00 MB (+0.000) - Start
Notes 1.000 seconds (+1.000); 3.00 MB (+3.000) - Middle
Notes 1.813 seconds (+0.813); 6.24 MB (+3.240) - End

```

You can see each line is qualified by the name you used when creating your profiler, and then the names you used for the mark.

The start point (the first marked point) is the reference, and by consequence has a null time and memory usage.

We can see that the code executed between the "Start" and the "Middle" point took 1 second to perform and increased the memory usage by 3 Mega Bytes.

Writing your own Renderer
-------------------------

[](#writing-your-own-renderer)

You can write your own renderer if you need an other formatting. In order to do so, you need to implement the ProfilerRendererInterface.

```
namespace MyApp;

use Joomla\Profiler\ProfilerRendererInterface;
use Joomla\Profiler\ProfilerInterface;

class MyRenderer implements ProfilerRendererInterface
{
	/**
	 * Renders a profiler.
	 * We want to display the point names and the elapsed time in front of them.
	 *
	 * start : +0 seconds
	 * middle : +x seconds
	 * end : +y seconds.
	 */
	public function render(ProfilerInterface $profiler)
	{
		// Prepare the string.
		$render = '';

		// Initialize a variable containing the last point.
		$lastPoint = null;

		// Get the points in the profiler.
		$points = $profiler->getPoints();

		foreach ($points as $point)
		{
			// Get the time of the last point (if any).
			$lastTime = $lastPoint ? $lastPoint->getTime() : 0;

			$render .= sprintf('%s: %f seconds.', $point->getName(), $point->getTime() - $lastTime);
			$render .= '';

			$lastPoint = $point;
		}

		return $render;
	}
}
```

Now you can set your renderer in the Profiler :

```
$profiler->setRenderer(new MyRenderer);

echo $profiler;
```

It should output something like :

```
Start: 0.000000 seconds.
Middle: 0.000172 seconds.
End: 0.000016 seconds.

```

Installation via Composer
-------------------------

[](#installation-via-composer)

Add `"joomla/profiler": "~3.0"` to the require block in your composer.json and then run `composer install`.

```
{
	"require": {
		"joomla/profiler": "~3.0"
	}
}
```

Alternatively, you can simply run the following from the command line:

```
composer require joomla/profiler "~3.0"
```

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance55

Moderate activity, may be stable

Popularity31

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity87

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 52.3% 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 ~295 days

Recently: every ~163 days

Total

16

Last Release

296d ago

Major Versions

1.2.0 → 2.0.0-beta2020-06-05

2.0.1 → 3.0.02023-10-08

3.0.3 → 4.0.02025-07-23

PHP version history (6 changes)1.0-alphaPHP &gt;=5.3.10

1.2.0PHP &gt;=5.3.10|&gt;=7.0

2.0.0-betaPHP ^7.2.5

2.0.1PHP ^7.2.5|~8.0.0|~8.1.0

3.0.0PHP ^8.1.0

4.0.0PHP ^8.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/305a2164440014dcef9ac681c139fe5e8a1ce1d7a8c3b3cfb828497729a4c70e?d=identicon)[wilsonge](/maintainers/wilsonge)

---

Top Contributors

[![mbabker](https://avatars.githubusercontent.com/u/368545?v=4)](https://github.com/mbabker "mbabker (56 commits)")[![Hackwar](https://avatars.githubusercontent.com/u/313866?v=4)](https://github.com/Hackwar "Hackwar (22 commits)")[![dongilbert](https://avatars.githubusercontent.com/u/718028?v=4)](https://github.com/dongilbert "dongilbert (7 commits)")[![nibra](https://avatars.githubusercontent.com/u/827605?v=4)](https://github.com/nibra "nibra (4 commits)")[![wilsonge](https://avatars.githubusercontent.com/u/1986000?v=4)](https://github.com/wilsonge "wilsonge (3 commits)")[![heelc29](https://avatars.githubusercontent.com/u/66922325?v=4)](https://github.com/heelc29 "heelc29 (3 commits)")[![richard67](https://avatars.githubusercontent.com/u/7413183?v=4)](https://github.com/richard67 "richard67 (3 commits)")[![realityking](https://avatars.githubusercontent.com/u/628508?v=4)](https://github.com/realityking "realityking (2 commits)")[![joomla-jenkins](https://avatars.githubusercontent.com/u/929228?v=4)](https://github.com/joomla-jenkins "joomla-jenkins (2 commits)")[![PhilETaylor](https://avatars.githubusercontent.com/u/400092?v=4)](https://github.com/PhilETaylor "PhilETaylor (1 commits)")[![ianmacl](https://avatars.githubusercontent.com/u/176534?v=4)](https://github.com/ianmacl "ianmacl (1 commits)")[![andrepereiradasilva](https://avatars.githubusercontent.com/u/9630530?v=4)](https://github.com/andrepereiradasilva "andrepereiradasilva (1 commits)")[![photodude](https://avatars.githubusercontent.com/u/10253980?v=4)](https://github.com/photodude "photodude (1 commits)")[![eddieajau](https://avatars.githubusercontent.com/u/700871?v=4)](https://github.com/eddieajau "eddieajau (1 commits)")

---

Tags

joomlajoomla-frameworkphpprofilerframeworkprofilerjoomla

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/joomla-profiler/health.svg)

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

###  Alternatives

[joomla/filter

Joomla Filter Package

151.4M8](/packages/joomla-filter)[joomla/application

Joomla Application Package

23404.8k11](/packages/joomla-application)[joomla/http

Joomla HTTP Package

17674.4k12](/packages/joomla-http)[joomla/registry

Joomla Registry Package

16468.6k20](/packages/joomla-registry)[joomla/di

Joomla DI Package

15391.2k11](/packages/joomla-di)[joomla/filesystem

Joomla Filesystem Package

12369.7k7](/packages/joomla-filesystem)

PHPackages © 2026

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