FireBug is a tool that helps developers develop and maintain their PHP applications by providing a dedicated debug panel that can be rendered anywhere within your application. Out of the box, it provides a way to debug your application by providing a
debugger() function along with a dedicated debugger panel.
FireBug can be installed by using Composer:
composer require ua1-labs/firebug
Since debugging tends to be a global effort within most PHP applications, we decided early on to force FireBug into a singleton design pattern. So, anytime you want to interact with FireBug, you can get an instance:
$fireBug = \UA1Labs\Fire\Bug::get();
For performance reasons, we decided to disable FireBug by default. Which means that if you would like to use FireBug with your application, you will need to enable it.
Once FireBug is enabled, it will start a timer that will report how much time it takes to load your page and return your request. Keep in mind, that times are determined by when you enable FireBug.
Part of the power of FireBug is the ability to render it anywhere on the page. You can choose to integrate it as a permanent part of your application or just render it when you want to.
As mentioned before, FireBug comes bundled with a “Debuggers” panel. This panel allows you to replace your use of
debug_trace. When FireBug is installed in your application, all you have to do is call the
debugger(mixed $value); function and let FireBug do the work. This function can take any value and will simply
debug_trace it within the “Debuggers” panel of FireBug.
Debuggers also take a second parameter called
exit. If you decide you need to exit the execution of any process and render the debug panel at that point in execution, you may do so by passing in true as a second parameter.
debugger('debug value...', true);