What is the correct way to add PHP DebugBar without hacking core?
Permalink 1 user found helpful
Since 5.7 is now built with modern day PHP and uses composer etc, i was thinking adding something like php debugbar would be fairly easy to do (without editing core files) but i havent seen alot of documentation on extending core at that level.
Using PHP Debug bar as an example (http://phpdebugbar.com/) what would be the correct way to add this functionality? Is it even possible without hacking core?
Using PHP Debug bar as an example (http://phpdebugbar.com/) what would be the correct way to add this functionality? Is it even possible without hacking core?
I actually did this several times.
Method 1:
When i added debugbar to concrete's composer.json, and ran composer update, it updated ALL the bundles in the concrete project too! This broke concrete itself (Got a white screen of death after doing this) maybe wild cards should not be used in the composer file for release versions? Also, isnt this technically "hacking core" will these files not be overwritten when you update concrete5.7?
Method 2:
So i used "composer require" and installed just the DebugBar and used the same code in the Docs. I got an error that DebugBar class Could not be found. Probably because it has to be injected somewhere in the view object.
I am sure its possible to extend concrete5.7 at this level but i am trying to find out the proper way to do these things so i am not "hacking core"
Method 1:
When i added debugbar to concrete's composer.json, and ran composer update, it updated ALL the bundles in the concrete project too! This broke concrete itself (Got a white screen of death after doing this) maybe wild cards should not be used in the composer file for release versions? Also, isnt this technically "hacking core" will these files not be overwritten when you update concrete5.7?
Method 2:
So i used "composer require" and installed just the DebugBar and used the same code in the Docs. I got an error that DebugBar class Could not be found. Probably because it has to be injected somewhere in the view object.
I am sure its possible to extend concrete5.7 at this level but i am trying to find out the proper way to do these things so i am not "hacking core"
What if you run composer install before your installation and try if it still works? I've done an update on composer and it ran successfully. It shouldn't break your install. Composer is there to be used, if it can't be used, it's of no use right? So try with a clean install instead of an existing install?
As stated above, Method 2 worked. I successfully installed debugbar. I see it inside the vendor folder.
But when i put the code in the template, I get an error telling me that DebugBar object could not be found
But when i put the code in the template, I get an error telling me that DebugBar object could not be found
I decided to test composer update without trying to get phpdebug to work:
Fresh install of Concrete Version 5.7.4.2
Empty site
I ran composer update and get a white screen. No URL works anymore.
Fresh install of Concrete Version 5.7.4.2
Empty site
I ran composer update and get a white screen. No URL works anymore.
I did a composer require as well, and that part worked. No update or install, not needed I guess. I'm not too familiar with the rest, but the class couldn't be found on my end either. The file actually exists and I could find it under concrete/vendor. Perhaps someone else can jump in and explain what to do.
As for your blank screen, configure concrete5 to display errors (display_errors). I'm on my iPad right now, but you can find the info right here:https://www.concrete5.org/community/forums/5-7-discussion/how-to-ove... It's the second post, at the very bottom. Put that in your application/config/concrete.php
As for your blank screen, configure concrete5 to display errors (display_errors). I'm on my iPad right now, but you can find the info right here:https://www.concrete5.org/community/forums/5-7-discussion/how-to-ove... It's the second post, at the very bottom. Put that in your application/config/concrete.php
Thanks for your help Ramon,
As for the composer update error, after doing as you mentioned, i see the true error:
Looks like some bundle class was added/removed/changed in some newer version.
As for the composer update error, after doing as you mentioned, i see the true error:
Whoops \ Exception \ ErrorException (E_ERROR) HELP Class 'TrueBV\Punycode' not found ...... public function __construct($data = null) { $this->punycode = new Punycode('UTF-8'); parent::__construct($data); } ......
Looks like some bundle class was added/removed/changed in some newer version.
I have never heard of PHP Debug Bar until reading this thread.
I looked over some of the documentation and it looks very interesting.
I looked over some of the documentation and it looks very interesting.
Good news, developers Mnkras and Korvin very generously made a PHP Debug Bar package for everyone to use.
https://github.com/Mnkras/php_debugbar...
I am also including the package with the dependencies already installed as an attachment. It has everything it needs to be installed.
Once installed, the toolbar should be available to use.
I believe it needs further customization to make the most of what it can do.
https://github.com/Mnkras/php_debugbar...
I am also including the package with the dependencies already installed as an attachment. It has everything it needs to be installed.
Once installed, the toolbar should be available to use.
I believe it needs further customization to make the most of what it can do.
Nice! It works. Would it be possible to display controller variables in the debug bar?
@tolusonaike
I am not sure what type of customization could be done.
Also, it currently does not get POST/GET data from block and dashboard single page forms. These forms use AJAX to transfer data.
On the PHP Debug Bar website it lists that it handles AJAX requests. We all need to brainstorm to figure out how to enable AJAX request collection.
http://phpdebugbar.com/docs/ajax-and-stack.html#ajax-and-stacked-da...
I am not sure what type of customization could be done.
Also, it currently does not get POST/GET data from block and dashboard single page forms. These forms use AJAX to transfer data.
On the PHP Debug Bar website it lists that it handles AJAX requests. We all need to brainstorm to figure out how to enable AJAX request collection.
http://phpdebugbar.com/docs/ajax-and-stack.html#ajax-and-stacked-da...
Here's another nice debugging tool for Concrete5, that I found recently:
https://github.com/dorian-marchal/concrete5-kint-debug...
https://github.com/dorian-marchal/concrete5-kint-debug...
@jakobfuchs
Nice find, have you tried it yet?
Nice find, have you tried it yet?
Seems to be more or less of an extended xdebug functionality. This will only show if you use "their" dump version (d() instead of var_dump()). It's not a debug BAR like the OP shows. You have debug bars for other frameworks too, like laravel:https://cloud.githubusercontent.com/assets/973269/4270452/740c8c8c-3...
But this seems to be a sort of replacement for calling var_dump, from what I gather.
But this seems to be a sort of replacement for calling var_dump, from what I gather.
An addon for Kint is currently in the PRB.
All these discussions made me try out other options. I was able to get debugging working through phpstorm and it is mighty nice. As close to the .Net Visual Studio experience as i have gotten in PHP. Screenshot attached
+1 for phpstorm. I wouldn't be without it now.
+1 for phpstorm. I wouldn't be without it now.
You can easily drop that in your header and footer of your theme. If not everything is being debugged, you could look at using some before render events in a module's on start function or something.