PHPackages                             it-al-perugia/phalcon-debugbar - 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. it-al-perugia/phalcon-debugbar

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

it-al-perugia/phalcon-debugbar
==============================

Integrates PHP Debug Bar with Phalcon.

v1.0.0(3y ago)0682MITPHPPHP &gt;=5.5.0

Since Dec 21Pushed 3y ago1 watchersCompare

[ Source](https://github.com/it-al-perugia/phalcon-debugbar)[ Packagist](https://packagist.org/packages/it-al-perugia/phalcon-debugbar)[ RSS](/packages/it-al-perugia-phalcon-debugbar/feed)WikiDiscussions main Synced 1mo ago

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

[![Latest Stable Version](https://camo.githubusercontent.com/6b7de327538164ab36f122aa373b7c66409a3759b6a356dbbad82ff783da25a4/68747470733a2f2f706f7365722e707567782e6f72672f736e6f776169722f7068616c636f6e2d64656275676261722f762f737461626c65)](https://packagist.org/packages/snowair/phalcon-debugbar)[![Total Downloads](https://camo.githubusercontent.com/746e3911fa259a916752b48fa61d773d729831d8556a49479aad419423712abd/68747470733a2f2f706f7365722e707567782e6f72672f736e6f776169722f7068616c636f6e2d64656275676261722f646f776e6c6f616473)](https://packagist.org/packages/snowair/phalcon-debugbar)[![Latest Unstable Version](https://camo.githubusercontent.com/5c8f6b612d4741ec5df3f570adbe68c397199928739df68b412ffc7cc962f630/68747470733a2f2f706f7365722e707567782e6f72672f736e6f776169722f7068616c636f6e2d64656275676261722f762f756e737461626c65)](https://packagist.org/packages/snowair/phalcon-debugbar)[![License](https://camo.githubusercontent.com/1412c7239c84a89c773c3321dbba06ae6009f47d31f47306791cde4943ae547f/68747470733a2f2f706f7365722e707567782e6f72672f736e6f776169722f7068616c636f6e2d64656275676261722f6c6963656e7365)](https://packagist.org/packages/snowair/phalcon-debugbar)

Phalcon Debugbar
----------------

[](#phalcon-debugbar)

Integrates [PHP Debug Bar](https://github.com/maximebf/php-debugbar) with [Phalcon Framework](https://github.com/phalcon/cphalcon).

[中文说明](https://github.com/snowair/phalcon-debugbar/blob/master/README_zh.md)

Features
--------

[](#features)

1. Normal request capturing
2. Ajax request capturing
3. Redirect request chain capturing
4. Simple App, Multi module App and Micro App support
5. Data collected persistent : save to **Local File** or **MongoDB**, or **ElasticSearch**
6. Data storaged by sessionid, it's more firendly for team development.
7. You can close inject debugbar, and on a new browser tab, visit `/_debugbar/open` to see data(and it alse can be disabled).
8. Whoops Integration, and debugbar works well with it.
9. Support palcon 1.3.x,2.x,3.x, PHP5.5~7.1

### Support Collectors

[](#support-collectors)

- **MessagesCollector**: Collect custom message, support scalar, array and object
- **TimeDataCollector**: Collect custom time measure.
- **ExceptionsCollector**: Add a exception object to debugbar.
- **MemoryCollector**: Collect memory usage
- **QueryCollector**: Capture each SQL statement, measure spent time of each SQL, show EXPLAIN result of each SELECT statement
    - collect information from the `db` service. Only for Phalcon ORM.
- **DoctrineCollector**: Capture each SQL statement in Doctrine, measure spent time of each SQL.
    - collect information from the `entityManager` service. Only for Doctrine ORM.
- **RouteCollector**: Show Route info of current request.
    - collect information from the `router` service.
- **ViewCollector**: Show all the rendered templates, measure spent time of each template, show all the templates variables.
    - collect information from the `view` service.
- **PhalconRequestCollector**: Show request headers, cookies, server variables, response headers, querys, post data,raw body
    - collect information from the `request` service.
- **ConfigCollector**: Show the data in the config service.
    - collect information from the `config` service.
- **SessionCollectior**: Show session data
    - collect information from the `session` service.
- **SwiftMailCollector**: mailer info
    - collect information from the `mail` service.
- **LogsCollectors**: Show logs of current request. Support `Phalcon\Logger` and **Monolog**
    - collect information from the `log` service.
- **CacheCollectors**: Show caches summary (saved,gets,incs,decs,failds), and each cache operation detail.
    - collect information from the `cache` service.

Quick start
-----------

[](#quick-start)

### composer

[](#composer)

- install

    ```
    php composer.phar require --dev snowair/phalcon-debugbar

    ```
- update

    ```
    php composer.phar update snowair/phalcon-debugbar

    ```

### Modify index.php

[](#modify-indexphp)

1. Set your App Instance to DI:

    ```
    $application = new Phalcon\Mvc\Application( $di ); // Important: mustn't ignore $di param . The Same Micro APP: new Phalcon\Mvc\Micro($di);
    $di['app'] = $application; //  Important
    ```
2. Before handle app, register and boot debugbar provider.

    ```
    (new Snowair\Debugbar\ServiceProvider())->start();
    // after start the debugbar, you can do noting but handle your app right now.
    echo $application->handle()->getContent();
    ```
3. **optional** to use Whoops, modify the index.php, add follow codes bellow the debugbar service `start()` method.

    ```
    (new \Snowair\Debugbar\Whoops\WhoopsServiceProvider($di));

    ```

### Modify The ACL Code

[](#modify-the-acl-code)

Here is a example for INVO:

```
public function beforeDispatch(Event $event, Dispatcher $dispatcher)
    {
        $auth = $this->session->get('auth');
        if (!$auth){
            $role = 'Guests';
        } else {
            $role = 'Users';
        }

        $controller = $dispatcher->getControllerName();
        $action = $dispatcher->getActionName();

        /* Debugbar start */
        $ns = $dispatcher->getNamespaceName();
        if ($ns=='Snowair\Debugbar\Controllers') {
            return true;
        }
        /* Debugbar end */

        $acl = $this->getAcl();
        $allowed = $acl->isAllowed($role, $controller, $action);
        if ($allowed != Acl::ALLOW) {
            $dispatcher->forward(array(
                'controller' => 'errors',
                'action'     => 'show401'
            ));
                        $this->session->destroy();
            return false;
        }
    }

```

### Data Persistent

[](#data-persistent)

For **file** driver, the default directory for store debugbar data is `Runtime/phalcon`. If it doesn't exist, it will be created automatically. You can change it by reconfig.

For **mongodb** driver, You must install the **mongodb** extension and install the phplib : `composer require mongodb/mongodb`

For **elastic** driver, You must install the phplib : `composer require elasticsearch/elasticsearch:some-version`

### About baseUri

[](#about-baseuri)

Be aware of the **baseUri** configuration of your project, you **must** set a currect baseUri for your **uri** service.

If you are using apache, you should enable the Rewrite mod and have a `.htaccess` file under the baseUri directory.

If you are using nginx, you should enable the Rewrite mod and edit the location block of the server configuration like this:

```
    location @rewrite {
        # replace 'baseuri' to your real baseuri
        rewrite ^/baseuri/(.*)$ /baseuri/index.php?_url=/$1;
    }

```

More
----

[](#more)

### Use your config

[](#use-your-config)

Copy `config/debugbar.php` to your config directory, and change any settings you want. Then use your debugbar config file by:

```
(new Snowair\Debugbar\ServiceProvider('your-debugbar-config-file-path'))->start();
```

### Send custom messages to debugbar

[](#send-custom-messages-to-debugbar)

```
\PhalconDebug::startMeasure('start-1','how long');        // startMeasure($internal_sign_use_to_stop_measure, $label)
\PhalconDebug::addMeasurePoint('start');                  // measure the spent time from latest measurepoint to now.
\PhalconDebug::addMessage('this is a message', 'label');  // add a message using a custom label.
\PhalconDebug::info($var1,$var2, $var3, ...);  // add many messages once a time. See PSR-3 for other methods name.(debug,notice,warning,error,...)
\PhalconDebug::addMessageIfTrue('1 == "1"', 1=='1','custom_label'); // add message only when the second parameter is true
\PhalconDebug::addMessageIfTrue('will not show', 1=='0');
\PhalconDebug::addMessageIfFalse('1 != "0" ', 1=='0');       // add message only when the second parameter is false
\PhalconDebug::addMessageIfNull('condition is null', Null ); // add message only when the second parameter is NULL
\PhalconDebug::addMessageIfEmpty('condition is emtpy', $condition ); // add message only when the second parameter is empty
\PhalconDebug::addMessageIfNotEmpty('condition is not emtpy', $condition=[1] ); // add message only when the second parameter is not empty
\PhalconDebug::addException(new \Exception('oh , error'));
\PhalconDebug::addMeasurePoint('stop');
\PhalconDebug::stopMeasure('start-1');                    // stopMeasure($internal_sign_use_to_stop_measure)
```

### Volt Functions:

[](#volt-functions)

```
addMessage
addMessageIfTrue
addMessageIfFalse
addMessageIfNull
addMessageIfEmpty
addMessageIfNotEmpty
addException
addMeasurePoint
startMeasure
stopMeasure
debug/info/notice/warning/error/emergency/critical

```

#### Examples

[](#examples)

```
{{ debug( var1, var2 )}}
{{ info( var1, var2 )}}
{{ addMessageIfTrue('$var === true', var ) }}

```

### Multi Modules

[](#multi-modules)

Usually, You needn't modify any other files, if you follow rules bellow:

1. All the services for cache has a name contain `cache`.
2. All the services for db has a name start with `db` or end with `db`.
3. Visit `/_debugbar/open?m={modulename}` to open a independent debugbar page.

If your service name is't match these rules, you need attach it to debugbar:

```
// service.php
$di->set('read-db-test',function(...)); // db service
$di->set('redis',function(...)); // cache service
if ( $di->has('debugbar') ) {
    $debugbar = $di['debugbar'];
    $debugbar->attachDb('read-db-test');
    $debugbar->attachCache('redis');
}
```

### Troubleshooting

[](#troubleshooting)

- I strongly suggest you to assign a **host domain** to your project, and set the **baseUri** of `uri` service to `/`.
- For ajax/json request, the debug data only stored in the persistent directory as a json file. You can Load it to the debugbar form Openhandler(Open icon on the right).
- If the debugbar does not work, the most likely reason is that one or more collectors triggered a error in the runtime. You can modify the debugbar config file, close collector one by one, retry it until found the collector cause problem.
- For any problems, you can open an Issue on Github.

### Snapshots

[](#snapshots)

---

[![Screenshot](https://camo.githubusercontent.com/58e70f95cfe00bdbc9786bed8bfacc7aa42c78d526f9015d38e063089b4dc4b2/687474703a2f2f6769742e6f736368696e612e6e65742f7a687579616a69652f7068616c636f6e2d64656275676261722f7261772f6d61737465722f736e617073686f74732f6d6573736167652e706e67)](https://camo.githubusercontent.com/58e70f95cfe00bdbc9786bed8bfacc7aa42c78d526f9015d38e063089b4dc4b2/687474703a2f2f6769742e6f736368696e612e6e65742f7a687579616a69652f7068616c636f6e2d64656275676261722f7261772f6d61737465722f736e617073686f74732f6d6573736167652e706e67)

---

[![Screenshot](https://camo.githubusercontent.com/860f370645a3ea3aabfc926950d6df601b2ccf3d8fcaf63e86bd1af7c33d6733/687474703a2f2f6769742e6f736368696e612e6e65742f7a687579616a69652f7068616c636f6e2d64656275676261722f7261772f6d61737465722f736e617073686f74732f74696d656c696e652e706e67)](https://camo.githubusercontent.com/860f370645a3ea3aabfc926950d6df601b2ccf3d8fcaf63e86bd1af7c33d6733/687474703a2f2f6769742e6f736368696e612e6e65742f7a687579616a69652f7068616c636f6e2d64656275676261722f7261772f6d61737465722f736e617073686f74732f74696d656c696e652e706e67)

---

[![Screenshot](https://camo.githubusercontent.com/77aacfda99edc0e97e613b0524016d0fb9bbe2b06d62a263d576dfa2bcb52c01/687474703a2f2f6769742e6f736368696e612e6e65742f7a687579616a69652f7068616c636f6e2d64656275676261722f7261772f6d61737465722f736e617073686f74732f657863657074696f6e2e706e67)](https://camo.githubusercontent.com/77aacfda99edc0e97e613b0524016d0fb9bbe2b06d62a263d576dfa2bcb52c01/687474703a2f2f6769742e6f736368696e612e6e65742f7a687579616a69652f7068616c636f6e2d64656275676261722f7261772f6d61737465722f736e617073686f74732f657863657074696f6e2e706e67)

---

[![Screenshot](https://camo.githubusercontent.com/32892b6597ba4cbe79c5da2a6721f5f3ff6828e247a64319d9983c425f3bdd15/687474703a2f2f6769742e6f736368696e612e6e65742f7a687579616a69652f7068616c636f6e2d64656275676261722f7261772f6d61737465722f736e617073686f74732f726f7574652e706e67)](https://camo.githubusercontent.com/32892b6597ba4cbe79c5da2a6721f5f3ff6828e247a64319d9983c425f3bdd15/687474703a2f2f6769742e6f736368696e612e6e65742f7a687579616a69652f7068616c636f6e2d64656275676261722f7261772f6d61737465722f736e617073686f74732f726f7574652e706e67)

---

[![Screenshot](https://camo.githubusercontent.com/01aec722109f25d659da5eb75ab224583b0407b8a1ee31aa54ac47738684bf30/687474703a2f2f6769742e6f736368696e612e6e65742f7a687579616a69652f7068616c636f6e2d64656275676261722f7261772f6d61737465722f736e617073686f74732f64617461626173652e706e67)](https://camo.githubusercontent.com/01aec722109f25d659da5eb75ab224583b0407b8a1ee31aa54ac47738684bf30/687474703a2f2f6769742e6f736368696e612e6e65742f7a687579616a69652f7068616c636f6e2d64656275676261722f7261772f6d61737465722f736e617073686f74732f64617461626173652e706e67)

---

[![Screenshot](https://camo.githubusercontent.com/8e41c1fd3788d51325c16fbca3df5c35cc7c2a198501f7f9bcb18d829b2a71ad/687474703a2f2f6769742e6f736368696e612e6e65742f7a687579616a69652f7068616c636f6e2d64656275676261722f7261772f6d61737465722f736e617073686f74732f76696577732e706e67)](https://camo.githubusercontent.com/8e41c1fd3788d51325c16fbca3df5c35cc7c2a198501f7f9bcb18d829b2a71ad/687474703a2f2f6769742e6f736368696e612e6e65742f7a687579616a69652f7068616c636f6e2d64656275676261722f7261772f6d61737465722f736e617073686f74732f76696577732e706e67)

---

[![Screenshot](https://camo.githubusercontent.com/01c8de722546e06e2c3ae7fb1e19cbe3ee147ba6ac084fb73063361097039808/687474703a2f2f6769742e6f736368696e612e6e65742f7a687579616a69652f7068616c636f6e2d64656275676261722f7261772f6d61737465722f736e617073686f74732f6361636865732e706e67)](https://camo.githubusercontent.com/01c8de722546e06e2c3ae7fb1e19cbe3ee147ba6ac084fb73063361097039808/687474703a2f2f6769742e6f736368696e612e6e65742f7a687579616a69652f7068616c636f6e2d64656275676261722f7261772f6d61737465722f736e617073686f74732f6361636865732e706e67)

---

[![Screenshot](https://camo.githubusercontent.com/946a488943fe0c087ea6683ef47e185104f707b7b3a3b8d8102d9f37ec91abd8/687474703a2f2f6769742e6f736368696e612e6e65742f7a687579616a69652f7068616c636f6e2d64656275676261722f7261772f6d61737465722f736e617073686f74732f636f6e6669672e706e67)](https://camo.githubusercontent.com/946a488943fe0c087ea6683ef47e185104f707b7b3a3b8d8102d9f37ec91abd8/687474703a2f2f6769742e6f736368696e612e6e65742f7a687579616a69652f7068616c636f6e2d64656275676261722f7261772f6d61737465722f736e617073686f74732f636f6e6669672e706e67)

---

[![Screenshot](https://camo.githubusercontent.com/638d6bb3936991fdcedbac525d6156092a75edbb70460afb99afe616b5e11de9/687474703a2f2f6769742e6f736368696e612e6e65742f7a687579616a69652f7068616c636f6e2d64656275676261722f7261772f6d61737465722f736e617073686f74732f73657373696f6e2e706e67)](https://camo.githubusercontent.com/638d6bb3936991fdcedbac525d6156092a75edbb70460afb99afe616b5e11de9/687474703a2f2f6769742e6f736368696e612e6e65742f7a687579616a69652f7068616c636f6e2d64656275676261722f7261772f6d61737465722f736e617073686f74732f73657373696f6e2e706e67)

---

[![Screenshot](https://camo.githubusercontent.com/510061b88cf54558183e3e81b41aca982b78629d9ae25db3906f4e164be60f8a/687474703a2f2f6769742e6f736368696e612e6e65742f7a687579616a69652f7068616c636f6e2d64656275676261722f7261772f6d61737465722f736e617073686f74732f726571756573742e706e67)](https://camo.githubusercontent.com/510061b88cf54558183e3e81b41aca982b78629d9ae25db3906f4e164be60f8a/687474703a2f2f6769742e6f736368696e612e6e65742f7a687579616a69652f7068616c636f6e2d64656275676261722f7261772f6d61737465722f736e617073686f74732f726571756573742e706e67)

---

[![Screenshot](https://camo.githubusercontent.com/92f3f75cb962d7b3a8359f02ee55bbf8bcc686bf4b08e5a27827fded63b1f8f8/687474703a2f2f6769742e6f736368696e612e6e65742f7a687579616a69652f7068616c636f6e2d64656275676261722f7261772f6d61737465722f736e617073686f74732f737461636b646174612e706e67)](https://camo.githubusercontent.com/92f3f75cb962d7b3a8359f02ee55bbf8bcc686bf4b08e5a27827fded63b1f8f8/687474703a2f2f6769742e6f736368696e612e6e65742f7a687579616a69652f7068616c636f6e2d64656275676261722f7261772f6d61737465722f736e617073686f74732f737461636b646174612e706e67)

###  Health Score

22

—

LowBetter than 23% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

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

Unknown

Total

1

Last Release

1235d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4d8f7f8da5256ec5f13c2339ee630c16b2645f8142db7262e6e63d07e008b450?d=identicon)[assistenza@it-al.it](/maintainers/assistenza@it-al.it)

---

Top Contributors

[![it-al-perugia](https://avatars.githubusercontent.com/u/121158461?v=4)](https://github.com/it-al-perugia "it-al-perugia (2 commits)")

---

Tags

debugprofilerdebugbarwebprofilerphalcon

### Embed Badge

![Health badge](/badges/it-al-perugia-phalcon-debugbar/health.svg)

```
[![Health](https://phpackages.com/badges/it-al-perugia-phalcon-debugbar/health.svg)](https://phpackages.com/packages/it-al-perugia-phalcon-debugbar)
```

###  Alternatives

[barryvdh/laravel-debugbar

PHP Debugbar integration for Laravel

19.1k124.3M621](/packages/barryvdh-laravel-debugbar)[fruitcake/laravel-debugbar

PHP Debugbar integration for Laravel

19.1k662.9k28](/packages/fruitcake-laravel-debugbar)[snowair/phalcon-debugbar

Integrates PHP Debug Bar with Phalcon.

160123.3k1](/packages/snowair-phalcon-debugbar)[fruitcake/laravel-telescope-toolbar

Toolbar for Laravel Telescope based on Symfony Web Profiler

8041.6M3](/packages/fruitcake-laravel-telescope-toolbar)[recca0120/laravel-tracy

A Laravel Package to integrate Nette Tracy Debugger

388283.0k3](/packages/recca0120-laravel-tracy)

PHPackages © 2026

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