PHPackages                             lajosbencz/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. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. lajosbencz/prophiler

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

lajosbencz/prophiler
====================

PHP Profiler &amp; Developer Toolbar built for Phalcon

1.4.0(10y ago)035BSD-3-ClausePHPPHP ~5.4

Since Nov 13Pushed 10y ago1 watchersCompare

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

READMEChangelogDependencies (9)Versions (12)Used By (0)

\#Prophiler - A PHP Profiler &amp; 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)

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) 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

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 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 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 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 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 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 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 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 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

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 78.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 ~38 days

Recently: every ~63 days

Total

8

Last Release

3936d ago

Major Versions

0.1.0 → 1.0.02014-11-25

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2552434?v=4)[lazos](/maintainers/lazos)[@lazos](https://github.com/lazos)

---

Top Contributors

[![fabfuel](https://avatars.githubusercontent.com/u/1582291?v=4)](https://github.com/fabfuel "fabfuel (180 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 (7 commits)")[![lajosbencz](https://avatars.githubusercontent.com/u/8420835?v=4)](https://github.com/lajosbencz "lajosbencz (3 commits)")[![ogarbe](https://avatars.githubusercontent.com/u/1395245?v=4)](https://github.com/ogarbe "ogarbe (2 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[filp/whoops

php error handling for cool kids

13.2k402.4M1.4k](/packages/filp-whoops)[symfony/error-handler

Provides tools to manage errors and ease debugging PHP code

2.7k651.8M581](/packages/symfony-error-handler)[php-debugbar/php-debugbar

Debug bar in the browser for php application

4.4k21.3M40](/packages/php-debugbar-php-debugbar)[symfony/ai-mate

AI development assistant MCP server for Symfony projects

1624.9k11](/packages/symfony-ai-mate)[koriym/xdebug-mcp

Universal PHP Xdebug MCP Server with AI-optimized debugging support

4011.6k1](/packages/koriym-xdebug-mcp)

PHPackages © 2026

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