You can extend the WordPress Debug Bar plugin adding new custom panels to fit your needs; for instance, showing responses from external APIs or webservices, or for other custom features.
// the 'debug_bar_panels' filter it's used by the plugin;
// hook into it to add your custom panel
add_filter( 'debug_bar_panels', 'my_custom_panel_init' );
/**
* Initialize my custom debug panel
* @param array $panels Debug bar panels objects
* @return array Debug bar panels with your custom panels
*/
function my_custom_panel_init( $panels ) {
// you'll be extending the Debug_Bar_Panel class provided
// by the plugin
class Debug_Bar_Custom_Panel extends Debug_Bar_Panel{
public function init(){
// you should set at least the title of your custom
// panel. it'll be used as the tab title
$this->title( 'Custom Panel' );
}
public function render(){
// build and echo your relevant output
}
}
// add your custom panel
$panels[] = new Debug_Bar_Custom_Panel();
return $panels;
}
That’s an extremely simple example. You can check a more complex and complete one by viewing the source of one of the Debug Bar extender plugins, such as the Debug-Bar-Shortcodes GitHub repo.