PHPackages                             fabfuel/prophiler - 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. fabfuel/prophiler

ActiveLibrary

fabfuel/prophiler
=================

PHP Profiler &amp; Developer Toolbar built for Phalcon

1.6.0(8y ago)440401.1k—9.7%52[1 issues](https://github.com/fabfuel/prophiler/issues)[6 PRs](https://github.com/fabfuel/prophiler/pulls)3BSD-3-ClausePHPPHP &gt;=5.5

Since Nov 13Pushed 5y ago41 watchersCompare

[ Source](https://github.com/fabfuel/prophiler)[ Packagist](https://packagist.org/packages/fabfuel/prophiler)[ RSS](/packages/fabfuel-prophiler/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (2)Dependencies (9)Versions (12)Used By (3)

Prophiler - A PHP Profiler &amp; Developer Toolbar built for Phalcon
====================================================================

[](#prophiler---a-php-profiler--developer-toolbar-built-for-phalcon)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/06bd80ea75371564b41326ab2baebec03bb41b8235bcdcc59915bc6066914fcf/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6661626675656c2f70726f7068696c65722f6261646765732f7175616c6974792d73636f72652e706e673f623d646576656c6f70)](https://scrutinizer-ci.com/g/fabfuel/prophiler/?branch=develop)[![Code Coverage](https://camo.githubusercontent.com/7287315c8a3010ad6a40f1014efdca580fe76c74616023f7512c8f0cc1c1c76e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6661626675656c2f70726f7068696c65722f6261646765732f636f7665726167652e706e673f623d646576656c6f70)](https://scrutinizer-ci.com/g/fabfuel/prophiler/?branch=develop)[![Build Status](https://camo.githubusercontent.com/337841b3786e5ddc9ece8f35ae2a3212f606aa5d05fb8a9d8fd6797daa3722ee/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6661626675656c2f70726f7068696c65722f6261646765732f6275696c642e706e673f623d646576656c6f70)](https://scrutinizer-ci.com/g/fabfuel/prophiler/build-status/develop)[![License](https://camo.githubusercontent.com/06c24a67fbe4862de5d86c808168f0df4dc9de7e22f6fdb7a676b330e8ada145/68747470733a2f2f706f7365722e707567782e6f72672f6661626675656c2f70726f7068696c65722f6c6963656e73652e737667)](https://packagist.org/packages/fabfuel/prophiler)[![Latest Stable Version](https://camo.githubusercontent.com/76e1eb8abbd9b594a12b4fd2d011a9f3634d5cfb36e840c72bac21bedd2c7abc/68747470733a2f2f706f7365722e707567782e6f72672f6661626675656c2f70726f7068696c65722f762f737461626c652e737667)](https://packagist.org/packages/fabfuel/prophiler)

Demo
----

[](#demo)

The demo website has been moved to a separate repository:

Here you can see the toolbar in action:

[![Timeline Preview](https://camo.githubusercontent.com/2c08b6e8ac179dfbf45addd7813e497665d52e31090fb34137871e311d0cb52e/687474703a2f2f70726f7068696c65722e6661626675656c2e64652f696d672f74696d656c696e652e706e67)](http://prophiler.fabfuel.de/)

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

[](#installation)

You can use composer to install the Prophiler. Just add it as dependency:

```
"require": {
   	"fabfuel/prophiler": "~1.0",
}

```

Setup (general)
---------------

[](#setup-general)

Setting up the Prophiler and the developer toolbar can be done via the following simple steps. It could all be done in your front-controller (e.g. `public/index.php` in Phalcon)

### 1. Initialize the Profiler (as soon as possible)

[](#1-initialize-the-profiler-as-soon-as-possible)

Generally it makes sense to initialize the profiler as soon as possible, to measure as much execution time as you can. You should initialize the profiler in your front-controller or the bootstrap file right after requiring the Composer autoloader.

```
$profiler = new \Fabfuel\Prophiler\Profiler();
```

### 2. Initialize and register the Toolbar

[](#2-initialize-and-register-the-toolbar)

To visualize the profiling results, you have to initialize and render the Prophiler Toolbar. This component takes care for rendering all results of the profiler benchmarks and other data collectors. Put that at the end of the front-controller.

You can also add other data collectors to the Toolbar, to show e.g. request data like in this example.

```
$toolbar = new \Fabfuel\Prophiler\Toolbar($profiler);
$toolbar->addDataCollector(new \Fabfuel\Prophiler\DataCollector\Request());
echo $toolbar->render();
```

You can also easily create you own data collectors, by implementing the `DataCollectorInterface` and adding an instance to the Toolbar.

```
...
$toolbar->addDataCollector(new \My\Custom\DataCollector());
...
```

Additional setup for Phalcon applications
-----------------------------------------

[](#additional-setup-for-phalcon-applications)

### 1. Add the profiler to the dependency injection container

[](#1-add-the-profiler-to-the-dependency-injection-container)

Add the profiler instance to the DI container, that other plugins and adapters can use it across the application. This should be done in or after your general DI setup.

```
$di->setShared('profiler', $profiler);
```

### 2. Initialize the plugin manager

[](#2-initialize-the-plugin-manager)

The plugin manager registers all included Phalcon plugins automatically and attaches them to the events manager. To make the plugins work properly, make sure that the default events manager is attached to your Dispatcher, View and Connection services.

```
$pluginManager = new \Fabfuel\Prophiler\Plugin\Manager\Phalcon($profiler);
$pluginManager->register();
```

Custom Benchmarks
-----------------

[](#custom-benchmarks)

You can easily add custom benchmarks to your code:

```
$benchmark = $profiler->start('\My\Class::doSomething', ['additional' => 'information'], 'My Component');
...
$profiler->stop($benchmark);
```

### Or stop without passing the benchmark

[](#or-stop-without-passing-the-benchmark)

In some scenarios (e.g. custom adapters) it might be hard to pass the received benchmark to the `stop()` method. Alternatively you can simply omit the `$benchmark` parameter. If that is the case, the profiler simply stops the last started benchmark, but it is not possible to run overlapping benchmarks.

```
$profiler->start('\My\Class::doSomeOtherThing', ['additional' => 'information'], 'My Component');
...
$profiler->stop();
```

Aggregations
------------

[](#aggregations)

Prophiler now features benchmark aggregations. These give you a lot more insights and are extremely useful to:

- quickly see the total number of recurring executions (e.g. database or cache queries)
- analyze minimum, maximum and average execution times of recurring executions
- easily see (e.g. accidentally) recurring executions of the same database query
- get a warning, if the total number of executions exceeds a custom threshold
- get a warning, if the maximum execution time exceeds a custom threshold

### Setup

[](#setup)

Prophiler comes with some aggregators, but you can easily create your own. To Set up an aggregator, all you need to do is to register the aggregator at the profiler instance:

```
$profiler->addAggregator(new \Fabfuel\Prophiler\Aggregator\Database\QueryAggregator());
$profiler->addAggregator(new \Fabfuel\Prophiler\Aggregator\Cache\CacheAggregator());
```

That's it. You immediately see all database and cache queries, grouped by command/query, including the total number of executions, the total duration of all executions as well as the minimum, maximum and average execution time.

Logging
-------

[](#logging)

You can use Prophiler to log events and other data and view it in the timeline and in the separate "Logs" tab. If you already have a logging infrastructure, you can add the PSR-3 compliant `Logger` adapter to it. Otherwise you can also just instantiate and use it directly:

```
$logger = new \Fabfuel\Prophiler\Adapter\Psr\Log\Logger($profiler);
$logger->warning('This is a warning!', ['some' => 'context']);
$logger->debug('Some debugging information', ['query' => ['user' => 12345], 'foo' => 'bar']);
```

Adapters and Decorators
-----------------------

[](#adapters-and-decorators)

### Doctrine

[](#doctrine)

To profile all SQL queries made by Doctrine, you just have to register the SQLLogger adapter in your Doctrine configuration, for example in your `bootstrap.php` like that:

```
$sqlLogger = new Fabfuel\Prophiler\Adapter\Doctrine\SQLLogger($profiler);
$entityManager->getConnection()->getConfiguration()->setSQLLogger($sqlLogger);
```

### PDO

[](#pdo)

To profile your PDO database actions, you can use the Prophiler PDO decorator. It will record all `query()` &amp; `exec()` calls and prepared statements as well. Just decorate your PDO instance with the Prophiler decorator and use that instead:

```
$pdo = new PDO('mysql:host=localhost;dbname=test', 'user', 'password');
$db = new \Fabfuel\Prophiler\Decorator\PDO\PDO($pdo, $profiler);

$db->query('SELECT * from users');
$db->exec('DELETE FROM users WHERE active = 0');
$db->prepare('SELECT * from users WHERE userId = ?');
```

### Cache

[](#cache)

To profile Phalcon cache backend requests, you only need to decorate the cache backend with the BackendDecorator. It will benchmark all cache operations automatically. Here is an example with the APC backend:

```
$cacheFrontend = new \Phalcon\Cache\Frontend\Data(['lifetime' => 172800]);
$cacheBackend = new \Phalcon\Cache\Backend\Apc($cacheFrontend, ['prefix' => 'app-data']);

$cache = \Fabfuel\Prophiler\Decorator\Phalcon\Cache\BackendDecorator($cacheBackend, $profiler);
```

### Elasticsearch

[](#elasticsearch)

To profile Elasticsearch requests, you only need to decorate the Elasticsearch client with the ClientDecorator:

```
$elasticsearch = new Elasticsearch\Client(['your' => 'config']);
$client = new \Fabfuel\Prophiler\Decorator\Elasticsearch\ClientDecorator($client, $profiler);
```

Tips
----

[](#tips)

### Record session writing

[](#record-session-writing)

To record session writing, you can commit (this is also known as `session_write_close()`) the session before rendering the toolbar

```
session_commit();
```

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity55

Moderate usage in the ecosystem

Community32

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 74.2% 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 ~115 days

Recently: every ~219 days

Total

10

Last Release

3167d ago

Major Versions

0.1.0 → 1.0.02014-11-25

PHP version history (2 changes)1.0.1PHP ~5.4

1.6.0PHP &gt;=5.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/2fc07c3ab3f9cf9aa9ce632bb638bb81e564bfca69b3e8c9eda55d8f969765d2?d=identicon)[fabfuel](/maintainers/fabfuel)

---

Top Contributors

[![fabfuel](https://avatars.githubusercontent.com/u/1582291?v=4)](https://github.com/fabfuel "fabfuel (196 commits)")[![potfur](https://avatars.githubusercontent.com/u/1244857?v=4)](https://github.com/potfur "potfur (37 commits)")[![mdular](https://avatars.githubusercontent.com/u/1701626?v=4)](https://github.com/mdular "mdular (16 commits)")[![kscr-rocket](https://avatars.githubusercontent.com/u/1768816?v=4)](https://github.com/kscr-rocket "kscr-rocket (5 commits)")[![shochdoerfer](https://avatars.githubusercontent.com/u/596449?v=4)](https://github.com/shochdoerfer "shochdoerfer (4 commits)")[![ogarbe](https://avatars.githubusercontent.com/u/1395245?v=4)](https://github.com/ogarbe "ogarbe (2 commits)")[![lajosbencz](https://avatars.githubusercontent.com/u/8420835?v=4)](https://github.com/lajosbencz "lajosbencz (1 commits)")[![CyberBLN](https://avatars.githubusercontent.com/u/378377?v=4)](https://github.com/CyberBLN "CyberBLN (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")[![bryant1410](https://avatars.githubusercontent.com/u/3905501?v=4)](https://github.com/bryant1410 "bryant1410 (1 commits)")

---

Tags

benchmarkdeveloper-toolbarphalconphpphp-profilerprofiletoolbar

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/fabfuel-prophiler/health.svg)

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

###  Alternatives

[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k15.7k5](/packages/elgg-elgg)[api-platform/metadata

API Resource-oriented metadata attributes and factories

243.5M96](/packages/api-platform-metadata)[neos/flow

Flow Application Framework

862.0M451](/packages/neos-flow)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[flowwow/cloudpayments-php-client

cloudpayments api client

2188.2k](/packages/flowwow-cloudpayments-php-client)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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