{"id":13805706,"url":"https://github.com/snowair/phalcon-debugbar","last_synced_at":"2026-01-29T04:20:42.811Z","repository":{"id":28483700,"uuid":"31999809","full_name":"snowair/phalcon-debugbar","owner":"snowair","description":"A powerful debug and profilers tool for the Phalcon Framework","archived":false,"fork":false,"pushed_at":"2022-04-08T10:16:47.000Z","size":1173,"stargazers_count":161,"open_issues_count":12,"forks_count":51,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-10-24T05:56:25.424Z","etag":null,"topics":["debugbar","phalcon","profiler"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snowair.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-11T05:20:53.000Z","updated_at":"2025-08-17T14:37:08.000Z","dependencies_parsed_at":"2022-09-03T05:20:47.490Z","dependency_job_id":null,"html_url":"https://github.com/snowair/phalcon-debugbar","commit_stats":null,"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"purl":"pkg:github/snowair/phalcon-debugbar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowair%2Fphalcon-debugbar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowair%2Fphalcon-debugbar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowair%2Fphalcon-debugbar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowair%2Fphalcon-debugbar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snowair","download_url":"https://codeload.github.com/snowair/phalcon-debugbar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowair%2Fphalcon-debugbar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28862143,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T22:56:21.783Z","status":"online","status_checked_at":"2026-01-29T02:00:06.714Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["debugbar","phalcon","profiler"],"created_at":"2024-08-04T01:01:04.044Z","updated_at":"2026-01-29T04:20:42.792Z","avatar_url":"https://github.com/snowair.png","language":"PHP","funding_links":[],"categories":["Debug"],"sub_categories":[],"readme":"[![Latest Stable Version](https://poser.pugx.org/snowair/phalcon-debugbar/v/stable)](https://packagist.org/packages/snowair/phalcon-debugbar) \n[![Total Downloads](https://poser.pugx.org/snowair/phalcon-debugbar/downloads)](https://packagist.org/packages/snowair/phalcon-debugbar) \n[![Latest Unstable Version](https://poser.pugx.org/snowair/phalcon-debugbar/v/unstable)](https://packagist.org/packages/snowair/phalcon-debugbar) \n[![License](https://poser.pugx.org/snowair/phalcon-debugbar/license)](https://packagist.org/packages/snowair/phalcon-debugbar)\n\n## Phalcon Debugbar\n\nIntegrates [PHP Debug Bar](https://github.com/maximebf/php-debugbar) with [Phalcon Framework](https://github.com/phalcon/cphalcon).\n\n\n[中文说明](https://github.com/snowair/phalcon-debugbar/blob/master/README_zh.md)\n\n## Features\n\n1. Normal request capturing\n2. Ajax request capturing\n3. Redirect request chain capturing\n4. Simple App, Multi module App and Micro App support\n5. Data collected persistent : save to **Local File** or **MongoDB**, or **ElasticSearch**\n6. Data storaged by sessionid, it's more firendly for team development.\n7. You can close inject debugbar, and on a new browser tab, visit `/_debugbar/open` to see data(and it alse can be disabled).\n8. Whoops Integration, and debugbar works well with it.\n9. Support palcon 1.3.x,2.x,3.x, PHP5.5~7.1\n\n### Support Collectors\n\n- **MessagesCollector**: Collect custom message, support scalar, array and object\n- **TimeDataCollector**: Collect custom time measure.\n- **ExceptionsCollector**: Add a exception object to debugbar.\n- **MemoryCollector**: Collect memory usage\n- **QueryCollector**: Capture each SQL statement, measure spent time of each SQL, show EXPLAIN result of each SELECT statement\n    * collect information from the `db` service. Only for Phalcon ORM.\n- **DoctrineCollector**: Capture each SQL statement in Doctrine, measure spent time of each SQL.\n    * collect information from the `entityManager` service. Only for Doctrine ORM.\n- **RouteCollector**: Show Route info of current request.\n    * collect information from the `router` service.\n- **ViewCollector**:  Show all the rendered templates, measure spent time of each template, show all the templates variables.\n    * collect information from the `view` service.\n- **PhalconRequestCollector**: Show request headers, cookies, server variables, response headers, querys, post data,raw body\n    * collect information from the `request` service.\n- **ConfigCollector**: Show the data in the config service.\n    * collect information from the `config` service.\n- **SessionCollectior**: Show session data\n    * collect information from the `session` service.\n- **SwiftMailCollector**: mailer info\n    * collect information from the `mail` service.\n- **LogsCollectors**: Show logs of current request. Support `Phalcon\\Logger` and **Monolog**\n    * collect information from the `log` service.\n- **CacheCollectors**: Show caches summary (saved,gets,incs,decs,failds), and each cache operation detail.\n    * collect information from the `cache` service.\n\n## Quick start\n\n### composer\n\n* install\n\n    ```\n    php composer.phar require --dev snowair/phalcon-debugbar\n    ```\n* update\n\n    ```\n    php composer.phar update snowair/phalcon-debugbar\n    ```\n\n### Modify index.php\n\n1. Set your App Instance to DI:\n\n    ```php\n    $application = new Phalcon\\Mvc\\Application( $di ); // Important: mustn't ignore $di param . The Same Micro APP: new Phalcon\\Mvc\\Micro($di);\n    $di['app'] = $application; //  Important\n    ```\n\n2. Before handle app, register and boot debugbar provider. \n\n    ```php\n    (new Snowair\\Debugbar\\ServiceProvider())-\u003estart();\n    // after start the debugbar, you can do noting but handle your app right now.\n    echo $application-\u003ehandle()-\u003egetContent();\n    ```\n    \n3. **optional**  to use Whoops, modify the index.php, add follow codes bellow the debugbar service `start()` method.\n\n    ```\n    (new \\Snowair\\Debugbar\\Whoops\\WhoopsServiceProvider($di));\n    ```\n    \n### Modify The ACL Code\n\nHere is a example for INVO:\n\n```\npublic function beforeDispatch(Event $event, Dispatcher $dispatcher)\n    {\n        $auth = $this-\u003esession-\u003eget('auth');\n        if (!$auth){\n            $role = 'Guests';\n        } else {\n            $role = 'Users';\n        }\n        \n        $controller = $dispatcher-\u003egetControllerName();\n        $action = $dispatcher-\u003egetActionName();\n        \n        /* Debugbar start */\n        $ns = $dispatcher-\u003egetNamespaceName();\n        if ($ns=='Snowair\\Debugbar\\Controllers') {\n            return true;\n        }\n        /* Debugbar end */\n        \n        $acl = $this-\u003egetAcl();\n        $allowed = $acl-\u003eisAllowed($role, $controller, $action);\n        if ($allowed != Acl::ALLOW) {\n            $dispatcher-\u003eforward(array(\n                'controller' =\u003e 'errors',\n                'action'     =\u003e 'show401'\n            ));\n                        $this-\u003esession-\u003edestroy();\n            return false;\n        }\n    }\n```\n\n### Data Persistent\n\nFor **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.\n\nFor **mongodb** driver, You must install the **mongodb** extension and install the phplib : `composer require mongodb/mongodb`\n    \nFor **elastic** driver, You must install the phplib : `composer require elasticsearch/elasticsearch:some-version`\n\n### About baseUri\n\nBe aware of the **baseUri** configuration of your project, you **must** set a currect baseUri for your **uri** service.\n\nIf you are using apache, you should enable the Rewrite mod and have a `.htaccess` file under the baseUri directory.\n\nIf you are using nginx, you should enable the Rewrite mod and edit the location block of the server configuration like this:\n\n```\n    location @rewrite {\n        # replace 'baseuri' to your real baseuri\n        rewrite ^/baseuri/(.*)$ /baseuri/index.php?_url=/$1;\n    }\n```\n\n\n## More\n\n### Use your config\n\nCopy `config/debugbar.php` to your config directory, and change any settings you want. Then use your debugbar config file by:\n\n```php\n(new Snowair\\Debugbar\\ServiceProvider('your-debugbar-config-file-path'))-\u003estart();\n```\n\n### Send custom messages to debugbar\n\n```php\n\\PhalconDebug::startMeasure('start-1','how long');        // startMeasure($internal_sign_use_to_stop_measure, $label)\n\\PhalconDebug::addMeasurePoint('start');                  // measure the spent time from latest measurepoint to now.\n\\PhalconDebug::addMessage('this is a message', 'label');  // add a message using a custom label.\n\\PhalconDebug::info($var1,$var2, $var3, ...);  // add many messages once a time. See PSR-3 for other methods name.(debug,notice,warning,error,...)\n\\PhalconDebug::addMessageIfTrue('1 == \"1\"', 1=='1','custom_label'); // add message only when the second parameter is true\n\\PhalconDebug::addMessageIfTrue('will not show', 1=='0');\n\\PhalconDebug::addMessageIfFalse('1 != \"0\" ', 1=='0');       // add message only when the second parameter is false\n\\PhalconDebug::addMessageIfNull('condition is null', Null ); // add message only when the second parameter is NULL\n\\PhalconDebug::addMessageIfEmpty('condition is emtpy', $condition ); // add message only when the second parameter is empty\n\\PhalconDebug::addMessageIfNotEmpty('condition is not emtpy', $condition=[1] ); // add message only when the second parameter is not empty\n\\PhalconDebug::addException(new \\Exception('oh , error'));\n\\PhalconDebug::addMeasurePoint('stop');\n\\PhalconDebug::stopMeasure('start-1');                    // stopMeasure($internal_sign_use_to_stop_measure)\n```\n\n### Volt Functions:\n\n```\naddMessage\naddMessageIfTrue\naddMessageIfFalse\naddMessageIfNull\naddMessageIfEmpty\naddMessageIfNotEmpty\naddException\naddMeasurePoint\nstartMeasure\nstopMeasure\ndebug/info/notice/warning/error/emergency/critical\n```\n\n#### Examples\n\n```\n{{ debug( var1, var2 )}}\n{{ info( var1, var2 )}}\n{{ addMessageIfTrue('$var === true', var ) }}\n```\n\n### Multi Modules\n\nUsually, You needn't modify any other files, if you follow rules bellow:\n\n1. All the services for cache has a name contain `cache`.\n2. All the services for db has a name start with `db` or end with `db`.\n3. Visit `/_debugbar/open?m={modulename}` to open a independent  debugbar page.\n\nIf your service name is't match these rules, you need attach it to debugbar: \n\n```php\n// service.php\n$di-\u003eset('read-db-test',function(...)); // db service\n$di-\u003eset('redis',function(...)); // cache service\nif ( $di-\u003ehas('debugbar') ) {\n    $debugbar = $di['debugbar'];\n    $debugbar-\u003eattachDb('read-db-test');\n    $debugbar-\u003eattachCache('redis');\n}\n```\n\n### Troubleshooting\n\n* I strongly suggest you to assign a **host domain** to your project, and set the **baseUri** of `uri` service to `/`.\n\n* For ajax/json request, the debug data only stored in the persistent directory as a json file. You can\n Load it to the debugbar form Openhandler(Open icon on the right).\n\n* If the debugbar does not work, the most likely reason is that one or more collectors triggered a error in the runtime.\nYou can modify the debugbar config file, close collector one by one, retry it until found the collector cause problem.\n\n* For any problems, you can open an Issue on Github.\n\n### Snapshots\n\n\n* * * \n\n![Screenshot](http://git.oschina.net/zhuyajie/phalcon-debugbar/raw/master/snapshots/message.png)\n\n* * * \n\n![Screenshot](http://git.oschina.net/zhuyajie/phalcon-debugbar/raw/master/snapshots/timeline.png)\n\n* * * \n\n![Screenshot](http://git.oschina.net/zhuyajie/phalcon-debugbar/raw/master/snapshots/exception.png)\n\n* * * \n\n![Screenshot](http://git.oschina.net/zhuyajie/phalcon-debugbar/raw/master/snapshots/route.png)\n\n* * * \n\n![Screenshot](http://git.oschina.net/zhuyajie/phalcon-debugbar/raw/master/snapshots/database.png)\n\n* * * \n\n![Screenshot](http://git.oschina.net/zhuyajie/phalcon-debugbar/raw/master/snapshots/views.png)\n\n* * * \n\n![Screenshot](http://git.oschina.net/zhuyajie/phalcon-debugbar/raw/master/snapshots/caches.png)\n\n* * * \n\n![Screenshot](http://git.oschina.net/zhuyajie/phalcon-debugbar/raw/master/snapshots/config.png)\n\n* * * \n\n![Screenshot](http://git.oschina.net/zhuyajie/phalcon-debugbar/raw/master/snapshots/session.png)\n\n* * * \n\n![Screenshot](http://git.oschina.net/zhuyajie/phalcon-debugbar/raw/master/snapshots/request.png)\n\n* * * \n\n![Screenshot](http://git.oschina.net/zhuyajie/phalcon-debugbar/raw/master/snapshots/stackdata.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowair%2Fphalcon-debugbar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnowair%2Fphalcon-debugbar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowair%2Fphalcon-debugbar/lists"}