You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Displays a debug bar in the browser with information from php.
No more var_dump() in your code!
Note: Debug Bar is for development use only. Never install this on websites that are publicly accessible.
V3 Beta
Currently v3 is in beta. You can install it with composer require php-debugbar/php-debugbar:^3.0@beta.
See the Upgrade guide for more information and breaking changes.
Features:
Generic Debug Bar for PHP projects
Easy to integrate with any project
Clean, fast and easy to use interface
Handles AJAX request
Includes generic data collectors and collectors for well known libraries
The client side bar is 100% coded in plain javascript
Easily create your own collectors and their associated view in the bar
(drop me a message or submit a PR to add your DebugBar related project here)
Installation
The best way to install DebugBar is using Composer
with the following command:
composer require --dev php-debugbar/php-debugbar
Quick start
DebugBar is very easy to use and you can add it to any of your projects in no time.
The easiest way is using the render() functions
<?php// Require the Composer autoloader, if not already loadedrequire'vendor/autoload.php';
useDebugBar\StandardDebugBar;
$debugbar = newStandardDebugBar();
$debugbarRenderer = $debugbar->getJavascriptRenderer();
$debugbar["messages"]->addMessage("hello world!");
?>
<html>
<head>
<?phpecho$debugbarRenderer->renderHead() ?>
</head>
<body>
...
<?phpecho$debugbarRenderer->render() ?>
</body>
</html>
The DebugBar uses DataCollectors to collect data from your PHP code. Some of them are
automated but others are manual. Use the DebugBar like an array where keys are the
collector names. In our previous example, we add a message to the MessagesCollector:
To test, run php vendor/bin/phpunit.
To debug Browser tests, you can run PANTHER_NO_HEADLESS=1 vendor/bin/phpunit --debug. Run vendor/bin/bdi detect drivers to download the latest drivers.
Contributing
When contributing to the JavaScript codebase:
Run npm run lint and npm run build before committing
Fix any errors (warnings are acceptable but should be minimized)
Use npm run lint:fix for automatic fixes where possible
Follow the ES6+ patterns established in the codebase
When contributing to the PHP codebase:
Run composer check-style and composer analyse before committing.
Make sure the tests pass (see above)
Verify that the demo works correctly (php -S localhost:8000 demo/)