We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Introducing PhalconDebugWidget (PDW)

I created a debug widget similar to what you find in other frameworks (yii debug toolbar, django debug toolbar, etc...), and wanted to get some feedback on it. For now its mostly a proof of concept while I try to figure out the best entry points for getting data from the framework.

Its pretty basic for now. I mostly only use it for checking out $_SESSION and sql queries. I'm still very new to phalconphp (as I'm sure most of us here are) but would appreciate feedback.

Preview image here: https://raw2.github.com/jymboche/phalcon-debug-widget/master/preview.png

Github Project and Instructions Here: https://github.com/jymboche/phalcon-debug-widget

Thanks! -Micah



98.9k

Great work!

Looks great! I used Nette/Tracy till now, but without sql queries(no time for implementation of Tracy\IBarPanel with Phalcon). Your PDW has everything i need, thumps up!

Great. Thx for your work. Are you able to port your work to FirePHP https://www.firephp.org/ It is more useful because not interfere with design.



16.1k

@screenas Thanks for trying it out! Let me know if you have any suggestions for improvement/features.

@doit76 This is the first I've heard of firephp. I'll check it out. Maybe I can add config options to enable firephp logging rather than output to view. It looks like Phalcon already has a firephp logger in place so this could be easy: https://docs.phalcon.io/en/latest/reference/logging.html#firephp-logger



7.9k
edited Mar '14

whow !!

thank you very much for sharing this, it is really a great tool !!!



7.9k
Resource Usage

load time   0.016213 s
elapsed time    0.771374 s
mem 994.45 KB
mem peak    1,053.39 KB
session size    1.266 KB

can you please explain what represents each value ?



16.1k
edited Mar '14

Hey I just noticed your post. I hope this is meaningful:

Load Time: The time from when the debug widget was instantiated to when the last view was rendered (not including debug widget views)

Elapsed Time: The time from when the php process started in the request, to when the last view was rendered (not including debug widget views)

Mem: Returns the amount of memory, in bytes, that's currently being allocated to your PHP script

Mem Peak: Returns the peak of memory, in bytes, that's been allocated to your PHP script (over the life of the script I believe).

Session Size: An estimate of the $_SESSION variable in KB. Here is the exact method used:

printf('%0.3F KB' ,mb_strlen(serialize($_SESSION))/1024);

Thanks for trying it out. Its pretty simple as I'm still learning phalconphp myself. Let me know if you have any suggestions.



15.1k
edited Apr '14

Excellent work! I originally ported a debug toolbar from PhalconEye framework, but it was so invasive and required lot's of code changes. Yours works like a charm!

Only comment - It doesn't seem to be compatible with phalcon session adapters and bugs out when those are used :)



16.1k

@nazwa Thanks for the comment. I've only used a single module application with standard adapters so far in phalcon. The debug widget just dumps the $_SESSION global for now. Which session adapter are you using? I'm gonna test some out soon. I haven't really added anything to the widget since I made it.



24.8k

Hi there,

I'm really interested in your debug/toolbar but I've got an issue to make it work. I'm building an app based on Phalcon 2.0.0 "multi-module + shared layout template" (https://github.com/phalcon/mvc/tree/master/multiple-shared-layouts)

As far as I've configured my app, I've never used directly the loader. I declare and register my modules in my boostrap, and each module is registering its own namespace (see below)

Module.php:

[...] public function registerAutoloaders() { $loader = new \Phalcon\Loader();

$loader->registerNamespaces(array( 'Modules\Api\Controllers' => DIR . '/controllers/', 'Modules\Api\Models' => DIR . '/models/', ));

$loader->register(); } [...]

I would appreciate a bit of help here, there might be a few things to change to make it work in a multi-module architecture. Cheers