PHP Debug Bar for convenient display

Came across reference to PHP Debug Bar as something easier than xdebug to setup and better than die() style of debugging.

Steps for basic use:

  1. Use composer require maximebf/debugbar to add and then dump to enable autoload.
  2. Use 2-3 statements from docs to instantiate toolbar’s java interface.
  3. Be sure to specify the correct location relative to caller’s url. This is passed in parameter as listed below:

$debugbarRenderer = $debugbar->getJavascriptRenderer('../../vendor/maximebf/debugbar/src/DebugBar/Resources');

  1. Add debug objects as needed.
  2. Output the data at the end before </body>

<?php echo $debugbarRenderer->render() ?>

The debug bar appears at the bottom with different categories.

1 Like