Add new inline_css, inline_js, and inline_head keys on the AssetProvider::getAssets() function. This allows us to support collectors that require static assets that are not actually saved to a file. Then, update all the asset functions in JavascriptRenderer to support these new keys. An initial use case for this is supporting the HtmlDumper in Symfony’s VarDumper. HtmlDumper only provides the styles and scripts in inline HTML form. The static assets can be customized based on some configuration properties available on the HtmlDumper class. One can actually view the CSS/JS as a long PHP string/heredoc embedded in the HtmlDumper.php source code. They are only accessible via the getDumpHeader function, which returns the CSS/JS in a combined HTML string.
PHP Debug Bar
Displays a debug bar in the browser with information from php.
No more var_dump()
in your code!
Features:
- Generic debug bar
- 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 javascript
- Easily create your own collectors and their associated view in the bar
- Save and re-open previous requests
- Very well documented
Includes collectors for:
Checkout the demo for examples and phpdebugbar.com for a live example.
Integrations with other frameworks:
- Laravel
- Atomik
- XOOPS
- Zend Framework 2
- Phalcon
- SilverStripe
- Grav CMS
- Framework-agnostic middleware and PSR-7 with php-middleware/phpdebugbar.
(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 maximebf/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 loaded
require 'vendor/autoload.php';
use DebugBar\StandardDebugBar;
$debugbar = new StandardDebugBar();
$debugbarRenderer = $debugbar->getJavascriptRenderer();
$debugbar["messages"]->addMessage("hello world!");
?>
<html>
<head>
<?php echo $debugbarRenderer->renderHead() ?>
</head>
<body>
...
<?php echo $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
:
$debugbar["messages"]->addMessage("hello world!");
StandardDebugBar
activates the following collectors:
MemoryCollector
(memory)MessagesCollector
(messages)PhpInfoCollector
(php)RequestDataCollector
(request)TimeDataCollector
(time)ExceptionsCollector
(exceptions)
Learn more about DebugBar in the docs.