1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-06-10 08:05:49 +02:00
This commit is contained in:
maximebf 2013-08-13 12:32:37 +10:00
parent 37a8cb3f9a
commit fbf9ae7cbf
11 changed files with 1146 additions and 181 deletions

View File

@ -72,11 +72,6 @@
</li>
<li>
<a href="/docs/data-collectors.html#base-collectors">Base collectors</a>
</li>
</ol>
@ -137,6 +132,52 @@
</ol>
</li>
<li>
<a href="/docs/base-collectors.html#base-collectors">Base collectors</a>
<ol>
<li>
<a href="/docs/base-collectors.html#messages">Messages</a>
</li>
<li>
<a href="/docs/base-collectors.html#timedata">TimeData</a>
</li>
<li>
<a href="/docs/base-collectors.html#exceptions">Exceptions</a>
</li>
<li>
<a href="/docs/base-collectors.html#pdo">PDO</a>
</li>
<li>
<a href="/docs/base-collectors.html#requestdatacollector">RequestDataCollector</a>
</li>
<li>
<a href="/docs/base-collectors.html#aggregatedcollector">AggregatedCollector</a>
</li>
<li>
<a href="/docs/base-collectors.html#others">Others</a>
</li>
</ol>
</li>
<li>
@ -145,6 +186,16 @@
<ol>
<li>
<a href="/docs/bridge-collectors.html#cachecache">CacheCache</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#doctrine">Doctrine</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#monolog">Monolog</a>
@ -155,6 +206,16 @@
</li>
<li>
<a href="/docs/bridge-collectors.html#slim">Slim</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#swift-mailer">Swift Mailer</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#twig">Twig</a>
@ -191,7 +252,21 @@ No more <code>var_dump()</code> in your code!</p>
<li>Includes generic data collectors and collectors for well known libraries</li>
<li>The client side bar is 100% coded in javascript</li>
<li>Easily create your own collectors and their associated view in the bar</li>
<li><a href="http://phpdebugbar.com/docs">Very well documented</a></li>
</ul>
<p>Includes collectors for:</p>
<ul>
<li><a href="http://php.net/manual/en/book.pdo.php">PDO</a></li>
<li><a href="http://maximebf.github.io/CacheCache/">CacheCache</a></li>
<li><a href="http://doctrine-project.org">Doctrine</a></li>
<li><a href="https://github.com/Seldaek/monolog">Monolog</a></li>
<li><a href="http://propelorm.org/">Propel</a></li>
<li><a href="http://slimframework.com">Slim</a></li>
<li><a href="http://swiftmailer.org/">Swift Mailer</a></li>
<li><a href="http://twig.sensiolabs.org/">Twig</a></li>
</ul>
<p>Checkout the <a href="https://github.com/maximebf/php-debugbar/tree/master/demo">demo</a> for
examples and <a href="http://phpdebugbar.com">phpdebugbar.com</a> for a live example.</p>
<a name="installation"></a><h2>Installation</h2>
<p>The easiest way to install DebugBar is using <a href="https://github.com/composer/composer">Composer</a>
with the following requirement:</p>
@ -235,7 +310,7 @@ $debugbar[&quot;messages&quot;]-&gt;addMessage(&quot;hello world!&quot;);
automated but others are manual. Use the <code>DebugBar</code> like an array where keys are the
collector names. In our previous example, we add a message to the <code>MessagesCollector</code>:</p>
<pre><code>$debugbar[&quot;messages&quot;]-&gt;addMessage(&quot;hello world!&quot;);</code></pre>
<p><code>StandardDebugBar</code> activates all bundled collectors:</p>
<p><code>StandardDebugBar</code> activates the following collectors:</p>
<ul>
<li><code>MemoryCollector</code> (<em>memory</em>)</li>
<li><code>MessagesCollector</code> (<em>messages</em>)</li>
@ -259,7 +334,21 @@ No more <code>var_dump()</code> in your code!</p>
<li>Includes generic data collectors and collectors for well known libraries</li>
<li>The client side bar is 100% coded in javascript</li>
<li>Easily create your own collectors and their associated view in the bar</li>
<li><a href="http://phpdebugbar.com/docs">Very well documented</a></li>
</ul>
<p>Includes collectors for:</p>
<ul>
<li><a href="http://php.net/manual/en/book.pdo.php">PDO</a></li>
<li><a href="http://maximebf.github.io/CacheCache/">CacheCache</a></li>
<li><a href="http://doctrine-project.org">Doctrine</a></li>
<li><a href="https://github.com/Seldaek/monolog">Monolog</a></li>
<li><a href="http://propelorm.org/">Propel</a></li>
<li><a href="http://slimframework.com">Slim</a></li>
<li><a href="http://swiftmailer.org/">Swift Mailer</a></li>
<li><a href="http://twig.sensiolabs.org/">Twig</a></li>
</ul>
<p>Checkout the <a href="https://github.com/maximebf/php-debugbar/tree/master/demo">demo</a> for
examples and <a href="http://phpdebugbar.com">phpdebugbar.com</a> for a live example.</p>
<a name="installation"></a><h2>Installation</h2>
<p>The easiest way to install DebugBar is using <a href="https://github.com/composer/composer">Composer</a>
with the following requirement:</p>
@ -303,7 +392,7 @@ $debugbar[&quot;messages&quot;]-&gt;addMessage(&quot;hello world!&quot;);
automated but others are manual. Use the <code>DebugBar</code> like an array where keys are the
collector names. In our previous example, we add a message to the <code>MessagesCollector</code>:</p>
<pre><code>$debugbar[&quot;messages&quot;]-&gt;addMessage(&quot;hello world!&quot;);</code></pre>
<p><code>StandardDebugBar</code> activates all bundled collectors:</p>
<p><code>StandardDebugBar</code> activates the following collectors:</p>
<ul>
<li><code>MemoryCollector</code> (<em>memory</em>)</li>
<li><code>MessagesCollector</code> (<em>messages</em>)</li>
@ -371,44 +460,6 @@ in <code>JavascriptRenderer::addControl($name, $options)</code> (see Rendering c
}
}</code></pre>
<p>This will have the result of adding a new indicator to the debug bar.</p>
<a name="base-collectors"></a><h2>Base collectors</h2>
<p>Provided by the <code>DebugBar\DataCollector</code> namespace.</p>
<a name="messages"></a><h3>Messages</h3>
<p>Provides a way to log messages (compotible with <a href="https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md">PSR-3 logger</a>).</p>
<pre><code>$debugbar-&gt;addCollector(new MessagesCollector());
$debugbar[&#39;message&#39;]-&gt;info(&#39;hello world&#39;);</code></pre>
<a name="timedata"></a><h3>TimeData</h3>
<p>Provides a way to log total execution time as well as taking &quot;measures&quot; (ie. measure the exution time of a particular operation).</p>
<pre><code>$debugbar-&gt;addCollector(new TimeDataCollector());
$debugbar[&#39;time&#39;]-&gt;startMeasure(&#39;longop&#39;, &#39;My long operation&#39;);
sleep(2);
$debugbar[&#39;time&#39;]-&gt;stopMeasure(&#39;longop&#39;);
$debugbar[&#39;time&#39;]-&gt;measure(&#39;My long operation&#39;, function() {
sleep(2);
});</code></pre>
<p>Displays the measures on a timeline</p>
<a name="exceptions"></a><h3>Exceptions</h3>
<p>Display exceptions</p>
<pre><code>$debugbar-&gt;addCollector(new ExceptionsCollector());
try {
throw new Exception(&#39;foobar&#39;);
} catch (Exception $e) {
$debugbar[&#39;exceptions&#39;]-&gt;addException($e);
}</code></pre>
<a name="pdo"></a><h3>PDO</h3>
<p>Logs SQL queries. You need to wrap your <code>PDO</code> object into a <code>DebugBar\DataCollector\PDO\TraceablePDO</code> object.</p>
<pre><code>$pdo = new PDO\TraceablePDO(new PDO(&#39;sqlite::memory:&#39;));
$debugbar-&gt;addCollector(new PDO\PDOCollector($pdo));</code></pre>
<a name="others"></a><h3>Others</h3>
<p>Misc collectors which you can just register:</p>
<ul>
<li><code>MemoryCollector</code> (<em>memory</em>)</li>
<li><code>PhpInfoCollector</code> (<em>php</em>)</li>
<li><code>RequestDataCollector</code> (<em>request</em>)</li>
</ul>
<a name="rendering"></a><h1>Rendering</h1>
<p>Rendering is performed using the `DebugBar\JavascriptRenderer̀ class. It contains
@ -506,6 +557,8 @@ or indicator.</p>
&quot;map&quot; =&gt; &quot;messages&quot;,
&quot;default&quot; =&gt; &quot;[]&quot;
));</code></pre>
<p>You can disable a control using <code>disableControl($name)</code> and ignore any controls provided by
a collector using <code>ignoreCollector($name)</code>.</p>
<a name="javascript-bar"></a><h1>Javascript Bar</h1>
<p>The default client side implementation of the debug bar is made
@ -636,18 +689,102 @@ and indicators of type <code>PhpDebugBar.DebugBar.Indicator</code>. These classe
debugbar.addIndicator(&#39;phpdoc&#39;, new LinkIndicator({ href: &#39;http://doc.php.com&#39;, title: &#39;PHP doc&#39; }));</code></pre>
<a name="base-collectors"></a><h1>Base collectors</h1>
<p>Collectors provided in the <code>DebugBar\DataCollector</code> namespace.</p>
<a name="messages"></a><h2>Messages</h2>
<p>Provides a way to log messages (compotible with <a href="https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md">PSR-3 logger</a>).</p>
<pre><code>$debugbar-&gt;addCollector(new DebugBar\DataCollector\MessagesCollector());
$debugbar[&#39;messages&#39;]-&gt;info(&#39;hello world&#39;);</code></pre>
<p>You can have multiple messages collector by naming them:</p>
<pre><code>$debugbar-&gt;addCollector(new MessagesCollector(&#39;io_ops&#39;));
$debugbar[&#39;io_ops&#39;]-&gt;info(&#39;opening files&#39;);</code></pre>
<p>You can aggregate messages collector into other to have a unified view:</p>
<pre><code>$debugbar[&#39;messages&#39;]-&gt;aggregate($debugbar[&#39;io_ops&#39;]);</code></pre>
<p>If you don&#39;t want to create a standalone tab in the debug bar but still be able
to log messages from a different collector, you don&#39;t have to add the collector
to the debug bar:</p>
<pre><code>$debugbar[&#39;messages&#39;]-&gt;aggregate(new MessagesCollector(&#39;io_ops&#39;));</code></pre>
<a name="timedata"></a><h2>TimeData</h2>
<p>Provides a way to log total execution time as well as taking &quot;measures&quot; (ie. measure the execution time of a particular operation).</p>
<pre><code>$debugbar-&gt;addCollector(new DebugBar\DataCollector\TimeDataCollector());
$debugbar[&#39;time&#39;]-&gt;startMeasure(&#39;longop&#39;, &#39;My long operation&#39;);
sleep(2);
$debugbar[&#39;time&#39;]-&gt;stopMeasure(&#39;longop&#39;);
$debugbar[&#39;time&#39;]-&gt;measure(&#39;My long operation&#39;, function() {
sleep(2);
});</code></pre>
<p>Displays the measures on a timeline</p>
<a name="exceptions"></a><h2>Exceptions</h2>
<p>Display exceptions</p>
<pre><code>$debugbar-&gt;addCollector(new DebugBar\DataCollector\ExceptionsCollector());
try {
throw new Exception(&#39;foobar&#39;);
} catch (Exception $e) {
$debugbar[&#39;exceptions&#39;]-&gt;addException($e);
}</code></pre>
<a name="pdo"></a><h2>PDO</h2>
<p>Logs SQL queries. You need to wrap your <code>PDO</code> object into a <code>DebugBar\DataCollector\PDO\TraceablePDO</code> object.</p>
<pre><code>$pdo = new DebugBar\DataCollector\PDO\TraceablePDO(new PDO(&#39;sqlite::memory:&#39;));
$debugbar-&gt;addCollector(new DebugBar\DataCollector\PDO\PDOCollector($pdo));</code></pre>
<a name="requestdatacollector"></a><h2>RequestDataCollector</h2>
<p>Collects the data of PHP&#39;s global variables</p>
<pre><code>$debugbar-&gt;addCollector(new DebugBar\DataCollector\RequestDataCollector());</code></pre>
<a name="aggregatedcollector"></a><h2>AggregatedCollector</h2>
<p>Aggregates multiple collectors. Do not provide any widgets, you have to add your own controls.</p>
<pre><code>$debugbar-&gt;addCollector(new DebugBar\DataCollector\AggregatedCollector(&#39;all_messages&#39;, &#39;messages&#39;, &#39;time&#39;));
$debugbar[&#39;all_messages&#39;]-&gt;addCollector($debugbar[&#39;messages&#39;]);
$debugbar[&#39;all_messages&#39;]-&gt;addCollector(new MessagesCollector(&#39;mails&#39;));
$debugbar[&#39;all_messages&#39;][&#39;mails&#39;]-&gt;addMessage(&#39;sending mail&#39;);
$renderer = $debugbar-&gt;getJavascriptRenderer();
$renderer-&gt;addControl(&#39;all_messages&#39;, array(
&#39;widget&#39; =&gt; &#39;PhpDebugBar.Widgets.MessagesWidget&#39;,
&#39;map&#39; =&gt; &#39;all_messages&#39;,
&#39;default&#39; =&gt; &#39;[]&#39;;
));</code></pre>
<a name="others"></a><h2>Others</h2>
<p>Misc collectors which you can just register:</p>
<ul>
<li><code>MemoryCollector</code> (<em>memory</em>): Display memory usage</li>
<li><code>PhpInfoCollector</code> (<em>php</em>): PHP version number</li>
</ul>
<a name="bridge-collectors"></a><h1>Bridge collectors</h1>
<p>DebugBar comes with some &quot;bridge&quot; collectors. This collectors provides a way to integrate
other projets with the DebugBar.</p>
<a name="cachecache"></a><h2>CacheCache</h2>
<p><a href="http://maximebf.github.io/CacheCache/">http://maximebf.github.io/CacheCache/</a></p>
<p>Displays cache operations using <code>DebugBar\Bridge\CacheCacheCollector</code></p>
<pre><code>$cache = new CacheCache\Cache(new CacheCache\Backends\Memory());
$debugbar-&gt;addCollector(new DebugBar\Bridge\CacheCacheCollector($cache));</code></pre>
<p>CacheCache uses <a href="https://github.com/Seldaek/monolog">Monolog</a> for logging,
thus it is required to collect data.</p>
<p><code>CacheCacheCollector</code> subclasses <code>MonologCollector</code>, thus it can be
<a href="base-collectors.html#messages">aggregated in the messages view</a>.</p>
<a name="doctrine"></a><h2>Doctrine</h2>
<p><a href="http://doctrine-project.org">http://doctrine-project.org</a></p>
<p>Displays sql queries into an SQL queries view using <code>DebugBar\Bridge\DoctrineCollector</code>.
You will need to set a <code>Doctrine\DBAL\Logging\DebugStack</code> logger on your connection.</p>
<pre><code>$debugStack = new Doctrine\DBAL\Logging\DebugStack();
$entityManager-&gt;getConnection()-&gt;getConfiguration()-&gt;setSQLLogger($debugStack);
$debugbar-&gt;addCollector(new DebugBar\Bridge\DoctrineCollector($debugStack));</code></pre>
<p><code>DoctrineCollector</code> also accepts an <code>Doctrine\ORM\EntityManager</code> as argument
provided the <code>SQLLogger</code> is a ̀DebugStack`.</p>
<a name="monolog"></a><h2>Monolog</h2>
<p>Integrates Monolog messages into the messages view.</p>
<p><a href="https://github.com/Seldaek/monolog">https://github.com/Seldaek/monolog</a></p>
<p>Integrates Monolog messages into a message view using <code>DebugBar\Bridge\MonologCollector</code>.</p>
<pre><code>$logger = new Monolog\Logger(&#39;mylogger&#39;);
$debugbar-&gt;addCollector(new DebugBar\Bridge\MonologCollector($logger));</code></pre>
<p>Note that multiple logger can be collected:</p>
<pre><code>$debugbar[&#39;monolog&#39;]-&gt;addLogger($logger);</code></pre>
<p><code>MonologCollector</code> can be <a href="base-collectors.html#messages">aggregated</a> into the <code>MessagesCollector</code>.</p>
<a name="propel"></a><h2>Propel</h2>
<p>Logs propel queries into an SQL queries view. You will need to activate
Propel debug mode.</p>
<p><a href="http://propelorm.org/">http://propelorm.org/</a></p>
<p>Displays propel queries into an SQL queries view using <code>DebugBar\Bridge\PropelCollector</code>.
You will need to activate Propel debug mode.</p>
<pre><code>// before Propel::init()
$debugbar-&gt;addCollector(new DebugBar\Bridge\PropelCollector());
@ -658,9 +795,22 @@ Propel::init(&#39;/path/to/config&#39;);
DebugBar\Bridge\PropelCollector::enablePropelProfiling();</code></pre>
<p>Queries can be collected on a single connection by providing the <code>PropelPDO</code> object
to the <code>PropelCollector</code> as first argument.</p>
<a name="slim"></a><h2>Slim</h2>
<p><a href="http://slimframework.com">http://slimframework.com</a></p>
<p>Displays message from the Slim logger into a message view using <code>DebugBar\Bridge\SlimCollector</code>.</p>
<pre><code>$app = new Slim\Slim();
$debugbar-&gt;addCollector(new DebugBar\Bridge\SlimCollector($app));</code></pre>
<a name="swift-mailer"></a><h2>Swift Mailer</h2>
<p><a href="http://swiftmailer.org/">http://swiftmailer.org/</a></p>
<p>Display log messages and sent mail using <code>DebugBar\Bridge\SwiftMailer\SwiftLogCollector</code> and
<code>DebugBar\Bridge\SwiftMailer\SwiftMailCollector</code>.</p>
<pre><code>$mailer = Swift_Mailer::newInstance(Swift_NullTransport::newInstance());
$debugbar[&#39;messages&#39;]-&gt;aggregate(new DebugBar\Bridge\SwiftMailer\SwiftLogCollector($mailer));
$debugbar-&gt;addCollector(new DebugBar\Bridge\SwiftMailer\SwiftMailCollector($mailer));</code></pre>
<a name="twig"></a><h2>Twig</h2>
<p>Collects info about rendered templates. You need to wrap your <code>Twig_Environment</code> object
into a <code>DebugBar\Bridge\Twig\TraceableTwigEnvironment</code> object.</p>
<p><a href="http://twig.sensiolabs.org/">http://twig.sensiolabs.org/</a></p>
<p>Collects info about rendered templates using <code>DebugBar\Bridge\Twig\TwigCollector</code>.
You need to wrap your <code>Twig_Environment</code> object into a <code>DebugBar\Bridge\Twig\TraceableTwigEnvironment</code> object.</p>
<pre><code>$loader = new Twig_Loader_Filesystem(&#39;.&#39;);
$env = new DebugBar\Bridge\Twig\TraceableTwigEnvironment(new Twig_Environment($loader));
$debugbar-&gt;addCollector(new DebugBar\Bridge\Twig\TwigDataCollector($env));</code></pre>

317
docs/base-collectors.html Normal file
View File

@ -0,0 +1,317 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>PHP Debug Bar</title>
<link type="text/css" rel="stylesheet" href="/docs/assets/css/reset.css">
<link type="text/css" rel="stylesheet" href="http://yandex.st/highlightjs/6.1/styles/sunburst.min.css">
<link type="text/css" rel="stylesheet" href="/docs/assets/css/docs.css">
<link type="text/css" rel="stylesheet" href="/docs/assets/css/print.css" media="print">
<link type="text/css" rel="stylesheet" href="style.css">
<script type="text/javascript" src="/docs/assets/js/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="http://yandex.st/highlightjs/6.1/highlight.min.js"></script>
<script type="text/javascript" src="/docs/assets/js/lunr.min.js"></script>
<script type="text/javascript">var BASE_URL = "/docs/";</script>
<script type="text/javascript" src="/docs/assets/js/viewer.js"></script>
</head>
<body>
<div id="page">
<a name="top" />
<header id="header">
<h1><a href="/docs/">PHP Debug Bar</a></h1>
</header>
<div id="sidebar">
<form action="/docs/search.html"><input id="search" type="text" placeholder="Search" name="q" /></form>
<nav id="toc">
<ol>
<li>
<a href="/docs/readme.html#php-debug-bar">PHP Debug Bar</a>
<ol>
<li>
<a href="/docs/readme.html#installation">Installation</a>
</li>
<li>
<a href="/docs/readme.html#quick-start">Quick start</a>
</li>
</ol>
</li>
<li>
<a href="/docs/data-collectors.html#collecting-data">Collecting Data</a>
<ol>
<li>
<a href="/docs/data-collectors.html#using-collectors">Using collectors</a>
</li>
<li>
<a href="/docs/data-collectors.html#creating-collectors">Creating collectors</a>
</li>
</ol>
</li>
<li>
<a href="/docs/rendering.html#rendering">Rendering</a>
<ol>
<li>
<a href="/docs/rendering.html#assets">Assets</a>
</li>
<li>
<a href="/docs/rendering.html#the-javascript-object">The javascript object</a>
</li>
</ol>
</li>
<li>
<a href="/docs/javascript-bar.html#javascript-bar">Javascript Bar</a>
<ol>
<li>
<a href="/docs/javascript-bar.html#tabs-and-indicators">Tabs and indicators</a>
</li>
<li>
<a href="/docs/javascript-bar.html#data-mapping">Data mapping</a>
</li>
<li>
<a href="/docs/javascript-bar.html#datasets">Datasets</a>
</li>
<li>
<a href="/docs/javascript-bar.html#widgets">Widgets</a>
</li>
<li>
<a href="/docs/javascript-bar.html#custom-tabs-and-indicators">Custom tabs and indicators</a>
</li>
</ol>
</li>
<li>
<a href="/docs/base-collectors.html#base-collectors">Base collectors</a>
<ol>
<li>
<a href="/docs/base-collectors.html#messages">Messages</a>
</li>
<li>
<a href="/docs/base-collectors.html#timedata">TimeData</a>
</li>
<li>
<a href="/docs/base-collectors.html#exceptions">Exceptions</a>
</li>
<li>
<a href="/docs/base-collectors.html#pdo">PDO</a>
</li>
<li>
<a href="/docs/base-collectors.html#requestdatacollector">RequestDataCollector</a>
</li>
<li>
<a href="/docs/base-collectors.html#aggregatedcollector">AggregatedCollector</a>
</li>
<li>
<a href="/docs/base-collectors.html#others">Others</a>
</li>
</ol>
</li>
<li>
<a href="/docs/bridge-collectors.html#bridge-collectors">Bridge collectors</a>
<ol>
<li>
<a href="/docs/bridge-collectors.html#cachecache">CacheCache</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#doctrine">Doctrine</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#monolog">Monolog</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#propel">Propel</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#slim">Slim</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#swift-mailer">Swift Mailer</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#twig">Twig</a>
</li>
</ol>
</li>
</ol>
</nav>
<nav id="links">
<ul>
</ul>
</nav>
</div>
<div id="content">
<a name="base-collectors"></a><h1>Base collectors</h1>
<p>Collectors provided in the <code>DebugBar\DataCollector</code> namespace.</p>
<a name="messages"></a><h2>Messages</h2>
<p>Provides a way to log messages (compotible with <a href="https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md">PSR-3 logger</a>).</p>
<pre><code>$debugbar-&gt;addCollector(new DebugBar\DataCollector\MessagesCollector());
$debugbar[&#39;messages&#39;]-&gt;info(&#39;hello world&#39;);</code></pre>
<p>You can have multiple messages collector by naming them:</p>
<pre><code>$debugbar-&gt;addCollector(new MessagesCollector(&#39;io_ops&#39;));
$debugbar[&#39;io_ops&#39;]-&gt;info(&#39;opening files&#39;);</code></pre>
<p>You can aggregate messages collector into other to have a unified view:</p>
<pre><code>$debugbar[&#39;messages&#39;]-&gt;aggregate($debugbar[&#39;io_ops&#39;]);</code></pre>
<p>If you don&#39;t want to create a standalone tab in the debug bar but still be able
to log messages from a different collector, you don&#39;t have to add the collector
to the debug bar:</p>
<pre><code>$debugbar[&#39;messages&#39;]-&gt;aggregate(new MessagesCollector(&#39;io_ops&#39;));</code></pre>
<a name="timedata"></a><h2>TimeData</h2>
<p>Provides a way to log total execution time as well as taking &quot;measures&quot; (ie. measure the execution time of a particular operation).</p>
<pre><code>$debugbar-&gt;addCollector(new DebugBar\DataCollector\TimeDataCollector());
$debugbar[&#39;time&#39;]-&gt;startMeasure(&#39;longop&#39;, &#39;My long operation&#39;);
sleep(2);
$debugbar[&#39;time&#39;]-&gt;stopMeasure(&#39;longop&#39;);
$debugbar[&#39;time&#39;]-&gt;measure(&#39;My long operation&#39;, function() {
sleep(2);
});</code></pre>
<p>Displays the measures on a timeline</p>
<a name="exceptions"></a><h2>Exceptions</h2>
<p>Display exceptions</p>
<pre><code>$debugbar-&gt;addCollector(new DebugBar\DataCollector\ExceptionsCollector());
try {
throw new Exception(&#39;foobar&#39;);
} catch (Exception $e) {
$debugbar[&#39;exceptions&#39;]-&gt;addException($e);
}</code></pre>
<a name="pdo"></a><h2>PDO</h2>
<p>Logs SQL queries. You need to wrap your <code>PDO</code> object into a <code>DebugBar\DataCollector\PDO\TraceablePDO</code> object.</p>
<pre><code>$pdo = new DebugBar\DataCollector\PDO\TraceablePDO(new PDO(&#39;sqlite::memory:&#39;));
$debugbar-&gt;addCollector(new DebugBar\DataCollector\PDO\PDOCollector($pdo));</code></pre>
<a name="requestdatacollector"></a><h2>RequestDataCollector</h2>
<p>Collects the data of PHP&#39;s global variables</p>
<pre><code>$debugbar-&gt;addCollector(new DebugBar\DataCollector\RequestDataCollector());</code></pre>
<a name="aggregatedcollector"></a><h2>AggregatedCollector</h2>
<p>Aggregates multiple collectors. Do not provide any widgets, you have to add your own controls.</p>
<pre><code>$debugbar-&gt;addCollector(new DebugBar\DataCollector\AggregatedCollector(&#39;all_messages&#39;, &#39;messages&#39;, &#39;time&#39;));
$debugbar[&#39;all_messages&#39;]-&gt;addCollector($debugbar[&#39;messages&#39;]);
$debugbar[&#39;all_messages&#39;]-&gt;addCollector(new MessagesCollector(&#39;mails&#39;));
$debugbar[&#39;all_messages&#39;][&#39;mails&#39;]-&gt;addMessage(&#39;sending mail&#39;);
$renderer = $debugbar-&gt;getJavascriptRenderer();
$renderer-&gt;addControl(&#39;all_messages&#39;, array(
&#39;widget&#39; =&gt; &#39;PhpDebugBar.Widgets.MessagesWidget&#39;,
&#39;map&#39; =&gt; &#39;all_messages&#39;,
&#39;default&#39; =&gt; &#39;[]&#39;;
));</code></pre>
<a name="others"></a><h2>Others</h2>
<p>Misc collectors which you can just register:</p>
<ul>
<li><code>MemoryCollector</code> (<em>memory</em>): Display memory usage</li>
<li><code>PhpInfoCollector</code> (<em>php</em>): PHP version number</li>
</ul>
</div>
<footer id="footer">
Powered by <a href="http://github.com/maximebf/beautiful-docs">beautiful-docs</a> -
<a href="#top">Back to top</a> - <a href="/docs/all.html">Everything on a single page</a>
- <a href="?print=1">Print current page</a> - <a href="/docs/all.html?print=1">Print all pages</a>
</footer>
</div>
</body>
</html>

View File

@ -72,11 +72,6 @@
</li>
<li>
<a href="/docs/data-collectors.html#base-collectors">Base collectors</a>
</li>
</ol>
@ -137,6 +132,52 @@
</ol>
</li>
<li>
<a href="/docs/base-collectors.html#base-collectors">Base collectors</a>
<ol>
<li>
<a href="/docs/base-collectors.html#messages">Messages</a>
</li>
<li>
<a href="/docs/base-collectors.html#timedata">TimeData</a>
</li>
<li>
<a href="/docs/base-collectors.html#exceptions">Exceptions</a>
</li>
<li>
<a href="/docs/base-collectors.html#pdo">PDO</a>
</li>
<li>
<a href="/docs/base-collectors.html#requestdatacollector">RequestDataCollector</a>
</li>
<li>
<a href="/docs/base-collectors.html#aggregatedcollector">AggregatedCollector</a>
</li>
<li>
<a href="/docs/base-collectors.html#others">Others</a>
</li>
</ol>
</li>
<li>
@ -145,6 +186,16 @@
<ol>
<li>
<a href="/docs/bridge-collectors.html#cachecache">CacheCache</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#doctrine">Doctrine</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#monolog">Monolog</a>
@ -155,6 +206,16 @@
</li>
<li>
<a href="/docs/bridge-collectors.html#slim">Slim</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#swift-mailer">Swift Mailer</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#twig">Twig</a>
@ -181,15 +242,36 @@
<a name="bridge-collectors"></a><h1>Bridge collectors</h1>
<p>DebugBar comes with some &quot;bridge&quot; collectors. This collectors provides a way to integrate
other projets with the DebugBar.</p>
<a name="cachecache"></a><h2>CacheCache</h2>
<p><a href="http://maximebf.github.io/CacheCache/">http://maximebf.github.io/CacheCache/</a></p>
<p>Displays cache operations using <code>DebugBar\Bridge\CacheCacheCollector</code></p>
<pre><code>$cache = new CacheCache\Cache(new CacheCache\Backends\Memory());
$debugbar-&gt;addCollector(new DebugBar\Bridge\CacheCacheCollector($cache));</code></pre>
<p>CacheCache uses <a href="https://github.com/Seldaek/monolog">Monolog</a> for logging,
thus it is required to collect data.</p>
<p><code>CacheCacheCollector</code> subclasses <code>MonologCollector</code>, thus it can be
<a href="base-collectors.html#messages">aggregated in the messages view</a>.</p>
<a name="doctrine"></a><h2>Doctrine</h2>
<p><a href="http://doctrine-project.org">http://doctrine-project.org</a></p>
<p>Displays sql queries into an SQL queries view using <code>DebugBar\Bridge\DoctrineCollector</code>.
You will need to set a <code>Doctrine\DBAL\Logging\DebugStack</code> logger on your connection.</p>
<pre><code>$debugStack = new Doctrine\DBAL\Logging\DebugStack();
$entityManager-&gt;getConnection()-&gt;getConfiguration()-&gt;setSQLLogger($debugStack);
$debugbar-&gt;addCollector(new DebugBar\Bridge\DoctrineCollector($debugStack));</code></pre>
<p><code>DoctrineCollector</code> also accepts an <code>Doctrine\ORM\EntityManager</code> as argument
provided the <code>SQLLogger</code> is a ̀DebugStack`.</p>
<a name="monolog"></a><h2>Monolog</h2>
<p>Integrates Monolog messages into the messages view.</p>
<p><a href="https://github.com/Seldaek/monolog">https://github.com/Seldaek/monolog</a></p>
<p>Integrates Monolog messages into a message view using <code>DebugBar\Bridge\MonologCollector</code>.</p>
<pre><code>$logger = new Monolog\Logger(&#39;mylogger&#39;);
$debugbar-&gt;addCollector(new DebugBar\Bridge\MonologCollector($logger));</code></pre>
<p>Note that multiple logger can be collected:</p>
<pre><code>$debugbar[&#39;monolog&#39;]-&gt;addLogger($logger);</code></pre>
<p><code>MonologCollector</code> can be <a href="base-collectors.html#messages">aggregated</a> into the <code>MessagesCollector</code>.</p>
<a name="propel"></a><h2>Propel</h2>
<p>Logs propel queries into an SQL queries view. You will need to activate
Propel debug mode.</p>
<p><a href="http://propelorm.org/">http://propelorm.org/</a></p>
<p>Displays propel queries into an SQL queries view using <code>DebugBar\Bridge\PropelCollector</code>.
You will need to activate Propel debug mode.</p>
<pre><code>// before Propel::init()
$debugbar-&gt;addCollector(new DebugBar\Bridge\PropelCollector());
@ -200,9 +282,22 @@ Propel::init(&#39;/path/to/config&#39;);
DebugBar\Bridge\PropelCollector::enablePropelProfiling();</code></pre>
<p>Queries can be collected on a single connection by providing the <code>PropelPDO</code> object
to the <code>PropelCollector</code> as first argument.</p>
<a name="slim"></a><h2>Slim</h2>
<p><a href="http://slimframework.com">http://slimframework.com</a></p>
<p>Displays message from the Slim logger into a message view using <code>DebugBar\Bridge\SlimCollector</code>.</p>
<pre><code>$app = new Slim\Slim();
$debugbar-&gt;addCollector(new DebugBar\Bridge\SlimCollector($app));</code></pre>
<a name="swift-mailer"></a><h2>Swift Mailer</h2>
<p><a href="http://swiftmailer.org/">http://swiftmailer.org/</a></p>
<p>Display log messages and sent mail using <code>DebugBar\Bridge\SwiftMailer\SwiftLogCollector</code> and
<code>DebugBar\Bridge\SwiftMailer\SwiftMailCollector</code>.</p>
<pre><code>$mailer = Swift_Mailer::newInstance(Swift_NullTransport::newInstance());
$debugbar[&#39;messages&#39;]-&gt;aggregate(new DebugBar\Bridge\SwiftMailer\SwiftLogCollector($mailer));
$debugbar-&gt;addCollector(new DebugBar\Bridge\SwiftMailer\SwiftMailCollector($mailer));</code></pre>
<a name="twig"></a><h2>Twig</h2>
<p>Collects info about rendered templates. You need to wrap your <code>Twig_Environment</code> object
into a <code>DebugBar\Bridge\Twig\TraceableTwigEnvironment</code> object.</p>
<p><a href="http://twig.sensiolabs.org/">http://twig.sensiolabs.org/</a></p>
<p>Collects info about rendered templates using <code>DebugBar\Bridge\Twig\TwigCollector</code>.
You need to wrap your <code>Twig_Environment</code> object into a <code>DebugBar\Bridge\Twig\TraceableTwigEnvironment</code> object.</p>
<pre><code>$loader = new Twig_Loader_Filesystem(&#39;.&#39;);
$env = new DebugBar\Bridge\Twig\TraceableTwigEnvironment(new Twig_Environment($loader));
$debugbar-&gt;addCollector(new DebugBar\Bridge\Twig\TwigDataCollector($env));</code></pre>

View File

@ -72,11 +72,6 @@
</li>
<li>
<a href="/docs/data-collectors.html#base-collectors">Base collectors</a>
</li>
</ol>
@ -137,6 +132,52 @@
</ol>
</li>
<li>
<a href="/docs/base-collectors.html#base-collectors">Base collectors</a>
<ol>
<li>
<a href="/docs/base-collectors.html#messages">Messages</a>
</li>
<li>
<a href="/docs/base-collectors.html#timedata">TimeData</a>
</li>
<li>
<a href="/docs/base-collectors.html#exceptions">Exceptions</a>
</li>
<li>
<a href="/docs/base-collectors.html#pdo">PDO</a>
</li>
<li>
<a href="/docs/base-collectors.html#requestdatacollector">RequestDataCollector</a>
</li>
<li>
<a href="/docs/base-collectors.html#aggregatedcollector">AggregatedCollector</a>
</li>
<li>
<a href="/docs/base-collectors.html#others">Others</a>
</li>
</ol>
</li>
<li>
@ -145,6 +186,16 @@
<ol>
<li>
<a href="/docs/bridge-collectors.html#cachecache">CacheCache</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#doctrine">Doctrine</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#monolog">Monolog</a>
@ -155,6 +206,16 @@
</li>
<li>
<a href="/docs/bridge-collectors.html#slim">Slim</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#swift-mailer">Swift Mailer</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#twig">Twig</a>
@ -235,44 +296,6 @@ in <code>JavascriptRenderer::addControl($name, $options)</code> (see Rendering c
}
}</code></pre>
<p>This will have the result of adding a new indicator to the debug bar.</p>
<a name="base-collectors"></a><h2>Base collectors</h2>
<p>Provided by the <code>DebugBar\DataCollector</code> namespace.</p>
<a name="messages"></a><h3>Messages</h3>
<p>Provides a way to log messages (compotible with <a href="https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md">PSR-3 logger</a>).</p>
<pre><code>$debugbar-&gt;addCollector(new MessagesCollector());
$debugbar[&#39;message&#39;]-&gt;info(&#39;hello world&#39;);</code></pre>
<a name="timedata"></a><h3>TimeData</h3>
<p>Provides a way to log total execution time as well as taking &quot;measures&quot; (ie. measure the exution time of a particular operation).</p>
<pre><code>$debugbar-&gt;addCollector(new TimeDataCollector());
$debugbar[&#39;time&#39;]-&gt;startMeasure(&#39;longop&#39;, &#39;My long operation&#39;);
sleep(2);
$debugbar[&#39;time&#39;]-&gt;stopMeasure(&#39;longop&#39;);
$debugbar[&#39;time&#39;]-&gt;measure(&#39;My long operation&#39;, function() {
sleep(2);
});</code></pre>
<p>Displays the measures on a timeline</p>
<a name="exceptions"></a><h3>Exceptions</h3>
<p>Display exceptions</p>
<pre><code>$debugbar-&gt;addCollector(new ExceptionsCollector());
try {
throw new Exception(&#39;foobar&#39;);
} catch (Exception $e) {
$debugbar[&#39;exceptions&#39;]-&gt;addException($e);
}</code></pre>
<a name="pdo"></a><h3>PDO</h3>
<p>Logs SQL queries. You need to wrap your <code>PDO</code> object into a <code>DebugBar\DataCollector\PDO\TraceablePDO</code> object.</p>
<pre><code>$pdo = new PDO\TraceablePDO(new PDO(&#39;sqlite::memory:&#39;));
$debugbar-&gt;addCollector(new PDO\PDOCollector($pdo));</code></pre>
<a name="others"></a><h3>Others</h3>
<p>Misc collectors which you can just register:</p>
<ul>
<li><code>MemoryCollector</code> (<em>memory</em>)</li>
<li><code>PhpInfoCollector</code> (<em>php</em>)</li>
<li><code>RequestDataCollector</code> (<em>request</em>)</li>
</ul>

View File

@ -72,11 +72,6 @@
</li>
<li>
<a href="/docs/data-collectors.html#base-collectors">Base collectors</a>
</li>
</ol>
@ -137,6 +132,52 @@
</ol>
</li>
<li>
<a href="/docs/base-collectors.html#base-collectors">Base collectors</a>
<ol>
<li>
<a href="/docs/base-collectors.html#messages">Messages</a>
</li>
<li>
<a href="/docs/base-collectors.html#timedata">TimeData</a>
</li>
<li>
<a href="/docs/base-collectors.html#exceptions">Exceptions</a>
</li>
<li>
<a href="/docs/base-collectors.html#pdo">PDO</a>
</li>
<li>
<a href="/docs/base-collectors.html#requestdatacollector">RequestDataCollector</a>
</li>
<li>
<a href="/docs/base-collectors.html#aggregatedcollector">AggregatedCollector</a>
</li>
<li>
<a href="/docs/base-collectors.html#others">Others</a>
</li>
</ol>
</li>
<li>
@ -145,6 +186,16 @@
<ol>
<li>
<a href="/docs/bridge-collectors.html#cachecache">CacheCache</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#doctrine">Doctrine</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#monolog">Monolog</a>
@ -155,6 +206,16 @@
</li>
<li>
<a href="/docs/bridge-collectors.html#slim">Slim</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#swift-mailer">Swift Mailer</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#twig">Twig</a>
@ -191,7 +252,21 @@ No more <code>var_dump()</code> in your code!</p>
<li>Includes generic data collectors and collectors for well known libraries</li>
<li>The client side bar is 100% coded in javascript</li>
<li>Easily create your own collectors and their associated view in the bar</li>
<li><a href="http://phpdebugbar.com/docs">Very well documented</a></li>
</ul>
<p>Includes collectors for:</p>
<ul>
<li><a href="http://php.net/manual/en/book.pdo.php">PDO</a></li>
<li><a href="http://maximebf.github.io/CacheCache/">CacheCache</a></li>
<li><a href="http://doctrine-project.org">Doctrine</a></li>
<li><a href="https://github.com/Seldaek/monolog">Monolog</a></li>
<li><a href="http://propelorm.org/">Propel</a></li>
<li><a href="http://slimframework.com">Slim</a></li>
<li><a href="http://swiftmailer.org/">Swift Mailer</a></li>
<li><a href="http://twig.sensiolabs.org/">Twig</a></li>
</ul>
<p>Checkout the <a href="https://github.com/maximebf/php-debugbar/tree/master/demo">demo</a> for
examples and <a href="http://phpdebugbar.com">phpdebugbar.com</a> for a live example.</p>
<a name="installation"></a><h2>Installation</h2>
<p>The easiest way to install DebugBar is using <a href="https://github.com/composer/composer">Composer</a>
with the following requirement:</p>
@ -235,7 +310,7 @@ $debugbar[&quot;messages&quot;]-&gt;addMessage(&quot;hello world!&quot;);
automated but others are manual. Use the <code>DebugBar</code> like an array where keys are the
collector names. In our previous example, we add a message to the <code>MessagesCollector</code>:</p>
<pre><code>$debugbar[&quot;messages&quot;]-&gt;addMessage(&quot;hello world!&quot;);</code></pre>
<p><code>StandardDebugBar</code> activates all bundled collectors:</p>
<p><code>StandardDebugBar</code> activates the following collectors:</p>
<ul>
<li><code>MemoryCollector</code> (<em>memory</em>)</li>
<li><code>MessagesCollector</code> (<em>messages</em>)</li>

View File

@ -72,11 +72,6 @@
</li>
<li>
<a href="/docs/data-collectors.html#base-collectors">Base collectors</a>
</li>
</ol>
@ -137,6 +132,52 @@
</ol>
</li>
<li>
<a href="/docs/base-collectors.html#base-collectors">Base collectors</a>
<ol>
<li>
<a href="/docs/base-collectors.html#messages">Messages</a>
</li>
<li>
<a href="/docs/base-collectors.html#timedata">TimeData</a>
</li>
<li>
<a href="/docs/base-collectors.html#exceptions">Exceptions</a>
</li>
<li>
<a href="/docs/base-collectors.html#pdo">PDO</a>
</li>
<li>
<a href="/docs/base-collectors.html#requestdatacollector">RequestDataCollector</a>
</li>
<li>
<a href="/docs/base-collectors.html#aggregatedcollector">AggregatedCollector</a>
</li>
<li>
<a href="/docs/base-collectors.html#others">Others</a>
</li>
</ol>
</li>
<li>
@ -145,6 +186,16 @@
<ol>
<li>
<a href="/docs/bridge-collectors.html#cachecache">CacheCache</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#doctrine">Doctrine</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#monolog">Monolog</a>
@ -155,6 +206,16 @@
</li>
<li>
<a href="/docs/bridge-collectors.html#slim">Slim</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#swift-mailer">Swift Mailer</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#twig">Twig</a>

View File

@ -12,7 +12,7 @@ documentTitles["/docs/readme.html#php-debug-bar"] = "PHP Debug Bar";
index.add({
url: "/docs/readme.html#php-debug-bar",
title: "PHP Debug Bar",
body: "# PHP Debug Bar Displays a debug bar in the browser with information from php. No more `var_dump()` in your code! ![Screenshot](https://raw.github.com/maximebf/php-debugbar/master/docs/screenshot.png) **Features:** - Generic debug bar with no other dependencies - 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 "
body: "# PHP Debug Bar Displays a debug bar in the browser with information from php. No more `var_dump()` in your code! ![Screenshot](https://raw.github.com/maximebf/php-debugbar/master/docs/screenshot.png) **Features:** - Generic debug bar with no other dependencies - 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 - [Very well documented](http://phpdebugbar.com/docs) Includes collectors for: - [PDO](http://php.net/manual/en/book.pdo.php) - [CacheCache](http://maximebf.github.io/CacheCache/) - [Doctrine](http://doctrine-project.org) - [Monolog](https://github.com/Seldaek/monolog) - [Propel](http://propelorm.org/) - [Slim](http://slimframework.com) - [Swift Mailer](http://swiftmailer.org/) - [Twig](http://twig.sensiolabs.org/) Checkout the [demo](https://github.com/maximebf/php-debugbar/tree/master/demo) for examples and [phpdebugbar.com](http://phpdebugbar.com) for a live example. "
});
documentTitles["/docs/readme.html#installation"] = "Installation";
@ -26,7 +26,7 @@ documentTitles["/docs/readme.html#quick-start"] = "Quick start";
index.add({
url: "/docs/readme.html#quick-start",
title: "Quick start",
body: "## Quick start DebugBar is very easy to use and you can add it to any of your projets in no time. The easiest way is using the `render()` functions &lt;?php use DebugBar\StandardDebugBar; use DebugBar\JavascriptRenderer; $debugbar = new StandardDebugBar(); $debugbarRenderer = $debugbar-&gt;getJavascriptRenderer(); $debugbar[\&quot;messages\&quot;]-&gt;addMessage(\&quot;hello world!\&quot;); ?&gt; &lt;html&gt; &lt;head&gt; &lt;?php echo $debugbarRenderer-&gt;renderHead() ?&gt; &lt;/head&gt; &lt;body&gt; ... &lt;?php echo $debugbarRenderer-&gt;render() ?&gt; &lt;/body&gt; &lt;/html&gt; 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[\&quot;messages\&quot;]-&gt;addMessage(\&quot;hello world!\&quot;); `StandardDebugBar` activates all bundled collectors: - `MemoryCollector` (*memory*) - `MessagesCollector` (*messages*) - `PhpInfoCollector` (*php*) - `RequestDataCollector` (*request*) - `TimeDataCollector` (*time*) - `ExceptionsCollector` (*exceptions*) Learn more about DebugBar in the [docs](http://phpdebugbar.com/docs). "
body: "## Quick start DebugBar is very easy to use and you can add it to any of your projets in no time. The easiest way is using the `render()` functions &lt;?php use DebugBar\StandardDebugBar; use DebugBar\JavascriptRenderer; $debugbar = new StandardDebugBar(); $debugbarRenderer = $debugbar-&gt;getJavascriptRenderer(); $debugbar[\&quot;messages\&quot;]-&gt;addMessage(\&quot;hello world!\&quot;); ?&gt; &lt;html&gt; &lt;head&gt; &lt;?php echo $debugbarRenderer-&gt;renderHead() ?&gt; &lt;/head&gt; &lt;body&gt; ... &lt;?php echo $debugbarRenderer-&gt;render() ?&gt; &lt;/body&gt; &lt;/html&gt; 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[\&quot;messages\&quot;]-&gt;addMessage(\&quot;hello world!\&quot;); `StandardDebugBar` activates the following collectors: - `MemoryCollector` (*memory*) - `MessagesCollector` (*messages*) - `PhpInfoCollector` (*php*) - `RequestDataCollector` (*request*) - `TimeDataCollector` (*time*) - `ExceptionsCollector` (*exceptions*) Learn more about DebugBar in the [docs](http://phpdebugbar.com/docs). "
});
@ -35,7 +35,7 @@ documentTitles["/docs/readme.html#php-debug-bar"] = "PHP Debug Bar";
index.add({
url: "/docs/readme.html#php-debug-bar",
title: "PHP Debug Bar",
body: "# PHP Debug Bar Displays a debug bar in the browser with information from php. No more `var_dump()` in your code! ![Screenshot](https://raw.github.com/maximebf/php-debugbar/master/docs/screenshot.png) **Features:** - Generic debug bar with no other dependencies - 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 "
body: "# PHP Debug Bar Displays a debug bar in the browser with information from php. No more `var_dump()` in your code! ![Screenshot](https://raw.github.com/maximebf/php-debugbar/master/docs/screenshot.png) **Features:** - Generic debug bar with no other dependencies - 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 - [Very well documented](http://phpdebugbar.com/docs) Includes collectors for: - [PDO](http://php.net/manual/en/book.pdo.php) - [CacheCache](http://maximebf.github.io/CacheCache/) - [Doctrine](http://doctrine-project.org) - [Monolog](https://github.com/Seldaek/monolog) - [Propel](http://propelorm.org/) - [Slim](http://slimframework.com) - [Swift Mailer](http://swiftmailer.org/) - [Twig](http://twig.sensiolabs.org/) Checkout the [demo](https://github.com/maximebf/php-debugbar/tree/master/demo) for examples and [phpdebugbar.com](http://phpdebugbar.com) for a live example. "
});
documentTitles["/docs/readme.html#installation"] = "Installation";
@ -49,7 +49,7 @@ documentTitles["/docs/readme.html#quick-start"] = "Quick start";
index.add({
url: "/docs/readme.html#quick-start",
title: "Quick start",
body: "## Quick start DebugBar is very easy to use and you can add it to any of your projets in no time. The easiest way is using the `render()` functions &lt;?php use DebugBar\StandardDebugBar; use DebugBar\JavascriptRenderer; $debugbar = new StandardDebugBar(); $debugbarRenderer = $debugbar-&gt;getJavascriptRenderer(); $debugbar[\&quot;messages\&quot;]-&gt;addMessage(\&quot;hello world!\&quot;); ?&gt; &lt;html&gt; &lt;head&gt; &lt;?php echo $debugbarRenderer-&gt;renderHead() ?&gt; &lt;/head&gt; &lt;body&gt; ... &lt;?php echo $debugbarRenderer-&gt;render() ?&gt; &lt;/body&gt; &lt;/html&gt; 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[\&quot;messages\&quot;]-&gt;addMessage(\&quot;hello world!\&quot;); `StandardDebugBar` activates all bundled collectors: - `MemoryCollector` (*memory*) - `MessagesCollector` (*messages*) - `PhpInfoCollector` (*php*) - `RequestDataCollector` (*request*) - `TimeDataCollector` (*time*) - `ExceptionsCollector` (*exceptions*) Learn more about DebugBar in the [docs](http://phpdebugbar.com/docs). "
body: "## Quick start DebugBar is very easy to use and you can add it to any of your projets in no time. The easiest way is using the `render()` functions &lt;?php use DebugBar\StandardDebugBar; use DebugBar\JavascriptRenderer; $debugbar = new StandardDebugBar(); $debugbarRenderer = $debugbar-&gt;getJavascriptRenderer(); $debugbar[\&quot;messages\&quot;]-&gt;addMessage(\&quot;hello world!\&quot;); ?&gt; &lt;html&gt; &lt;head&gt; &lt;?php echo $debugbarRenderer-&gt;renderHead() ?&gt; &lt;/head&gt; &lt;body&gt; ... &lt;?php echo $debugbarRenderer-&gt;render() ?&gt; &lt;/body&gt; &lt;/html&gt; 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[\&quot;messages\&quot;]-&gt;addMessage(\&quot;hello world!\&quot;); `StandardDebugBar` activates the following collectors: - `MemoryCollector` (*memory*) - `MessagesCollector` (*messages*) - `PhpInfoCollector` (*php*) - `RequestDataCollector` (*request*) - `TimeDataCollector` (*time*) - `ExceptionsCollector` (*exceptions*) Learn more about DebugBar in the [docs](http://phpdebugbar.com/docs). "
});
@ -72,49 +72,7 @@ documentTitles["/docs/data-collectors.html#creating-collectors"] = "Creating col
index.add({
url: "/docs/data-collectors.html#creating-collectors",
title: "Creating collectors",
body: "## Creating collectors Collectors must implement the `DebugBar\DataCollector\DataCollectorInterface`. They may subclass `DebugBar\DataCollector\DataCollector` which provides utility methods. Collectors must provide a `getName()` function returning their unique name and a `collect()` function returning some json-encodable data. The latter will be called at the same time the `DebugBar::collect()` method is called. class MyDataCollector extends DebugBar\DataCollector\DataCollector { public function collect() { return array(\&quot;uniqid\&quot; =&gt; uniqid()); } public function getName() { return 'mycollector'; } } $debugbar-&gt;addCollector(new MyDataCollector()); This however won't show anything in the debug bar as no information are provided on how to display these data. You could do that manually as you'll see in later chapter or implement the `DebugBar\DataSource\Renderable` interface. To implement it, you must define a `getWidgets()` function which returns an array of key/value pairs where key are control names and values control options as defined in `JavascriptRenderer::addControl($name, $options)` (see Rendering chapter). class MyDataCollector extends DebugBar\DataCollector\DataCollector implements DebugBar\DataCollector\Renderable { // ... public function getWidgets() { return array( \&quot;mycollector\&quot; =&gt; array( \&quot;icon\&quot; =&gt; \&quot;cogs\&quot;, \&quot;tooltip\&quot; =&gt; \&quot;uniqid()\&quot;, \&quot;map\&quot; =&gt; \&quot;uniqid\&quot;, \&quot;default\&quot; =&gt; \&quot;''\&quot; ) ); } } This will have the result of adding a new indicator to the debug bar. "
});
documentTitles["/docs/data-collectors.html#base-collectors"] = "Base collectors";
index.add({
url: "/docs/data-collectors.html#base-collectors",
title: "Base collectors",
body: "## Base collectors Provided by the `DebugBar\DataCollector` namespace. "
});
documentTitles["/docs/data-collectors.html#messages"] = "Messages";
index.add({
url: "/docs/data-collectors.html#messages",
title: "Messages",
body: "### Messages Provides a way to log messages (compotible with [PSR-3 logger](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md)). $debugbar-&gt;addCollector(new MessagesCollector()); $debugbar['message']-&gt;info('hello world'); "
});
documentTitles["/docs/data-collectors.html#timedata"] = "TimeData";
index.add({
url: "/docs/data-collectors.html#timedata",
title: "TimeData",
body: "### TimeData Provides a way to log total execution time as well as taking \&quot;measures\&quot; (ie. measure the exution time of a particular operation). $debugbar-&gt;addCollector(new TimeDataCollector()); $debugbar['time']-&gt;startMeasure('longop', 'My long operation'); sleep(2); $debugbar['time']-&gt;stopMeasure('longop'); $debugbar['time']-&gt;measure('My long operation', function() { sleep(2); }); Displays the measures on a timeline "
});
documentTitles["/docs/data-collectors.html#exceptions"] = "Exceptions";
index.add({
url: "/docs/data-collectors.html#exceptions",
title: "Exceptions",
body: "### Exceptions Display exceptions $debugbar-&gt;addCollector(new ExceptionsCollector()); try { throw new Exception('foobar'); } catch (Exception $e) { $debugbar['exceptions']-&gt;addException($e); } "
});
documentTitles["/docs/data-collectors.html#pdo"] = "PDO";
index.add({
url: "/docs/data-collectors.html#pdo",
title: "PDO",
body: "### PDO Logs SQL queries. You need to wrap your `PDO` object into a `DebugBar\DataCollector\PDO\TraceablePDO` object. $pdo = new PDO\TraceablePDO(new PDO('sqlite::memory:')); $debugbar-&gt;addCollector(new PDO\PDOCollector($pdo)); "
});
documentTitles["/docs/data-collectors.html#others"] = "Others";
index.add({
url: "/docs/data-collectors.html#others",
title: "Others",
body: "### Others Misc collectors which you can just register: - `MemoryCollector` (*memory*) - `PhpInfoCollector` (*php*) - `RequestDataCollector` (*request*) "
body: "## Creating collectors Collectors must implement the `DebugBar\DataCollector\DataCollectorInterface`. They may subclass `DebugBar\DataCollector\DataCollector` which provides utility methods. Collectors must provide a `getName()` function returning their unique name and a `collect()` function returning some json-encodable data. The latter will be called at the same time the `DebugBar::collect()` method is called. class MyDataCollector extends DebugBar\DataCollector\DataCollector { public function collect() { return array(\&quot;uniqid\&quot; =&gt; uniqid()); } public function getName() { return 'mycollector'; } } $debugbar-&gt;addCollector(new MyDataCollector()); This however won't show anything in the debug bar as no information are provided on how to display these data. You could do that manually as you'll see in later chapter or implement the `DebugBar\DataSource\Renderable` interface. To implement it, you must define a `getWidgets()` function which returns an array of key/value pairs where key are control names and values control options as defined in `JavascriptRenderer::addControl($name, $options)` (see Rendering chapter). class MyDataCollector extends DebugBar\DataCollector\DataCollector implements DebugBar\DataCollector\Renderable { // ... public function getWidgets() { return array( \&quot;mycollector\&quot; =&gt; array( \&quot;icon\&quot; =&gt; \&quot;cogs\&quot;, \&quot;tooltip\&quot; =&gt; \&quot;uniqid()\&quot;, \&quot;map\&quot; =&gt; \&quot;uniqid\&quot;, \&quot;default\&quot; =&gt; \&quot;''\&quot; ) ); } } This will have the result of adding a new indicator to the debug bar. "
});
@ -151,7 +109,7 @@ documentTitles["/docs/rendering.html#defining-controls"] = "Defining controls";
index.add({
url: "/docs/rendering.html#defining-controls",
title: "Defining controls",
body: "### Defining controls Controls can be manually added to the debug bar using `addControl($name, $options)`. You should read the Javascript bar chapter before this section. `$name` will be the name of your control and `$options` is a key/value pair array with these possible values: - *icon*: icon name - *tooltip*: string - *widget*: widget class name - *map*: a property name from the data to map the control to - *default*: a js string, default value of the data map - *tab*: class name of the tab object (to use a custom tab object) - *indicator*: class name of the indicator object (to use a custom indicator object) At least *icon* or *widget* are needed (unless *tab* or *indicator* are specified). If *widget* is specified, a tab will be created, otherwise an indicator. Any other options is also passed to the tab or indicator. $renderer-&gt;addControl('messages', array( \&quot;widget\&quot; =&gt; \&quot;PhpDebugBar.Widgets.MessagesWidget\&quot;, \&quot;map\&quot; =&gt; \&quot;messages\&quot;, \&quot;default\&quot; =&gt; \&quot;[]\&quot; )); "
body: "### Defining controls Controls can be manually added to the debug bar using `addControl($name, $options)`. You should read the Javascript bar chapter before this section. `$name` will be the name of your control and `$options` is a key/value pair array with these possible values: - *icon*: icon name - *tooltip*: string - *widget*: widget class name - *map*: a property name from the data to map the control to - *default*: a js string, default value of the data map - *tab*: class name of the tab object (to use a custom tab object) - *indicator*: class name of the indicator object (to use a custom indicator object) At least *icon* or *widget* are needed (unless *tab* or *indicator* are specified). If *widget* is specified, a tab will be created, otherwise an indicator. Any other options is also passed to the tab or indicator. $renderer-&gt;addControl('messages', array( \&quot;widget\&quot; =&gt; \&quot;PhpDebugBar.Widgets.MessagesWidget\&quot;, \&quot;map\&quot; =&gt; \&quot;messages\&quot;, \&quot;default\&quot; =&gt; \&quot;[]\&quot; )); You can disable a control using `disableControl($name)` and ignore any controls provided by a collector using `ignoreCollector($name)`."
});
@ -200,6 +158,64 @@ index.add({
documentTitles["/docs/base-collectors.html#base-collectors"] = "Base collectors";
index.add({
url: "/docs/base-collectors.html#base-collectors",
title: "Base collectors",
body: "# Base collectors Collectors provided in the `DebugBar\DataCollector` namespace. "
});
documentTitles["/docs/base-collectors.html#messages"] = "Messages";
index.add({
url: "/docs/base-collectors.html#messages",
title: "Messages",
body: "## Messages Provides a way to log messages (compotible with [PSR-3 logger](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md)). $debugbar-&gt;addCollector(new DebugBar\DataCollector\MessagesCollector()); $debugbar['messages']-&gt;info('hello world'); You can have multiple messages collector by naming them: $debugbar-&gt;addCollector(new MessagesCollector('io_ops')); $debugbar['io_ops']-&gt;info('opening files'); You can aggregate messages collector into other to have a unified view: $debugbar['messages']-&gt;aggregate($debugbar['io_ops']); If you don't want to create a standalone tab in the debug bar but still be able to log messages from a different collector, you don't have to add the collector to the debug bar: $debugbar['messages']-&gt;aggregate(new MessagesCollector('io_ops')); "
});
documentTitles["/docs/base-collectors.html#timedata"] = "TimeData";
index.add({
url: "/docs/base-collectors.html#timedata",
title: "TimeData",
body: "## TimeData Provides a way to log total execution time as well as taking \&quot;measures\&quot; (ie. measure the execution time of a particular operation). $debugbar-&gt;addCollector(new DebugBar\DataCollector\TimeDataCollector()); $debugbar['time']-&gt;startMeasure('longop', 'My long operation'); sleep(2); $debugbar['time']-&gt;stopMeasure('longop'); $debugbar['time']-&gt;measure('My long operation', function() { sleep(2); }); Displays the measures on a timeline "
});
documentTitles["/docs/base-collectors.html#exceptions"] = "Exceptions";
index.add({
url: "/docs/base-collectors.html#exceptions",
title: "Exceptions",
body: "## Exceptions Display exceptions $debugbar-&gt;addCollector(new DebugBar\DataCollector\ExceptionsCollector()); try { throw new Exception('foobar'); } catch (Exception $e) { $debugbar['exceptions']-&gt;addException($e); } "
});
documentTitles["/docs/base-collectors.html#pdo"] = "PDO";
index.add({
url: "/docs/base-collectors.html#pdo",
title: "PDO",
body: "## PDO Logs SQL queries. You need to wrap your `PDO` object into a `DebugBar\DataCollector\PDO\TraceablePDO` object. $pdo = new DebugBar\DataCollector\PDO\TraceablePDO(new PDO('sqlite::memory:')); $debugbar-&gt;addCollector(new DebugBar\DataCollector\PDO\PDOCollector($pdo)); "
});
documentTitles["/docs/base-collectors.html#requestdatacollector"] = "RequestDataCollector";
index.add({
url: "/docs/base-collectors.html#requestdatacollector",
title: "RequestDataCollector",
body: "## RequestDataCollector Collects the data of PHP's global variables $debugbar-&gt;addCollector(new DebugBar\DataCollector\RequestDataCollector()); "
});
documentTitles["/docs/base-collectors.html#aggregatedcollector"] = "AggregatedCollector";
index.add({
url: "/docs/base-collectors.html#aggregatedcollector",
title: "AggregatedCollector",
body: "## AggregatedCollector Aggregates multiple collectors. Do not provide any widgets, you have to add your own controls. $debugbar-&gt;addCollector(new DebugBar\DataCollector\AggregatedCollector('all_messages', 'messages', 'time')); $debugbar['all_messages']-&gt;addCollector($debugbar['messages']); $debugbar['all_messages']-&gt;addCollector(new MessagesCollector('mails')); $debugbar['all_messages']['mails']-&gt;addMessage('sending mail'); $renderer = $debugbar-&gt;getJavascriptRenderer(); $renderer-&gt;addControl('all_messages', array( 'widget' =&gt; 'PhpDebugBar.Widgets.MessagesWidget', 'map' =&gt; 'all_messages', 'default' =&gt; '[]'; )); "
});
documentTitles["/docs/base-collectors.html#others"] = "Others";
index.add({
url: "/docs/base-collectors.html#others",
title: "Others",
body: "## Others Misc collectors which you can just register: - `MemoryCollector` (*memory*): Display memory usage - `PhpInfoCollector` (*php*): PHP version number "
});
documentTitles["/docs/bridge-collectors.html#bridge-collectors"] = "Bridge collectors";
index.add({
url: "/docs/bridge-collectors.html#bridge-collectors",
@ -207,25 +223,53 @@ index.add({
body: "# Bridge collectors DebugBar comes with some \&quot;bridge\&quot; collectors. This collectors provides a way to integrate other projets with the DebugBar. "
});
documentTitles["/docs/bridge-collectors.html#cachecache"] = "CacheCache";
index.add({
url: "/docs/bridge-collectors.html#cachecache",
title: "CacheCache",
body: "## CacheCache http://maximebf.github.io/CacheCache/ Displays cache operations using `DebugBar\Bridge\CacheCacheCollector` $cache = new CacheCache\Cache(new CacheCache\Backends\Memory()); $debugbar-&gt;addCollector(new DebugBar\Bridge\CacheCacheCollector($cache)); CacheCache uses [Monolog](https://github.com/Seldaek/monolog) for logging, thus it is required to collect data. `CacheCacheCollector` subclasses `MonologCollector`, thus it can be [aggregated in the messages view](base-collectors.html#messages). "
});
documentTitles["/docs/bridge-collectors.html#doctrine"] = "Doctrine";
index.add({
url: "/docs/bridge-collectors.html#doctrine",
title: "Doctrine",
body: "## Doctrine http://doctrine-project.org Displays sql queries into an SQL queries view using `DebugBar\Bridge\DoctrineCollector`. You will need to set a `Doctrine\DBAL\Logging\DebugStack` logger on your connection. $debugStack = new Doctrine\DBAL\Logging\DebugStack(); $entityManager-&gt;getConnection()-&gt;getConfiguration()-&gt;setSQLLogger($debugStack); $debugbar-&gt;addCollector(new DebugBar\Bridge\DoctrineCollector($debugStack)); `DoctrineCollector` also accepts an `Doctrine\ORM\EntityManager` as argument provided the `SQLLogger` is a ̀DebugStack`. "
});
documentTitles["/docs/bridge-collectors.html#monolog"] = "Monolog";
index.add({
url: "/docs/bridge-collectors.html#monolog",
title: "Monolog",
body: "## Monolog Integrates Monolog messages into the messages view. $logger = new Monolog\Logger('mylogger'); $debugbar-&gt;addCollector(new DebugBar\Bridge\MonologCollector($logger)); Note that multiple logger can be collected: $debugbar['monolog']-&gt;addLogger($logger); "
body: "## Monolog https://github.com/Seldaek/monolog Integrates Monolog messages into a message view using `DebugBar\Bridge\MonologCollector`. $logger = new Monolog\Logger('mylogger'); $debugbar-&gt;addCollector(new DebugBar\Bridge\MonologCollector($logger)); Note that multiple logger can be collected: $debugbar['monolog']-&gt;addLogger($logger); `MonologCollector` can be [aggregated](base-collectors.html#messages) into the `MessagesCollector`. "
});
documentTitles["/docs/bridge-collectors.html#propel"] = "Propel";
index.add({
url: "/docs/bridge-collectors.html#propel",
title: "Propel",
body: "## Propel Logs propel queries into an SQL queries view. You will need to activate Propel debug mode. // before Propel::init() $debugbar-&gt;addCollector(new DebugBar\Bridge\PropelCollector()); Propel::init('/path/to/config'); // after Propel::init() // not mandatory if you set config options by yourself DebugBar\Bridge\PropelCollector::enablePropelProfiling(); Queries can be collected on a single connection by providing the `PropelPDO` object to the `PropelCollector` as first argument. "
body: "## Propel http://propelorm.org/ Displays propel queries into an SQL queries view using `DebugBar\Bridge\PropelCollector`. You will need to activate Propel debug mode. // before Propel::init() $debugbar-&gt;addCollector(new DebugBar\Bridge\PropelCollector()); Propel::init('/path/to/config'); // after Propel::init() // not mandatory if you set config options by yourself DebugBar\Bridge\PropelCollector::enablePropelProfiling(); Queries can be collected on a single connection by providing the `PropelPDO` object to the `PropelCollector` as first argument. "
});
documentTitles["/docs/bridge-collectors.html#slim"] = "Slim";
index.add({
url: "/docs/bridge-collectors.html#slim",
title: "Slim",
body: "## Slim http://slimframework.com Displays message from the Slim logger into a message view using `DebugBar\Bridge\SlimCollector`. $app = new Slim\Slim(); $debugbar-&gt;addCollector(new DebugBar\Bridge\SlimCollector($app)); "
});
documentTitles["/docs/bridge-collectors.html#swift-mailer"] = "Swift Mailer";
index.add({
url: "/docs/bridge-collectors.html#swift-mailer",
title: "Swift Mailer",
body: "## Swift Mailer http://swiftmailer.org/ Display log messages and sent mail using `DebugBar\Bridge\SwiftMailer\SwiftLogCollector` and `DebugBar\Bridge\SwiftMailer\SwiftMailCollector`. $mailer = Swift_Mailer::newInstance(Swift_NullTransport::newInstance()); $debugbar['messages']-&gt;aggregate(new DebugBar\Bridge\SwiftMailer\SwiftLogCollector($mailer)); $debugbar-&gt;addCollector(new DebugBar\Bridge\SwiftMailer\SwiftMailCollector($mailer)); "
});
documentTitles["/docs/bridge-collectors.html#twig"] = "Twig";
index.add({
url: "/docs/bridge-collectors.html#twig",
title: "Twig",
body: "## Twig Collects info about rendered templates. You need to wrap your `Twig_Environment` object into a `DebugBar\Bridge\Twig\TraceableTwigEnvironment` object. $loader = new Twig_Loader_Filesystem('.'); $env = new DebugBar\Bridge\Twig\TraceableTwigEnvironment(new Twig_Environment($loader)); $debugbar-&gt;addCollector(new DebugBar\Bridge\Twig\TwigDataCollector($env)); You can provide a `DebugBar\DataCollector\TimeDataCollector` as the second argument of `TraceableTwigEnvironment` so render operation can be measured. "
body: "## Twig http://twig.sensiolabs.org/ Collects info about rendered templates using `DebugBar\Bridge\Twig\TwigCollector`. You need to wrap your `Twig_Environment` object into a `DebugBar\Bridge\Twig\TraceableTwigEnvironment` object. $loader = new Twig_Loader_Filesystem('.'); $env = new DebugBar\Bridge\Twig\TraceableTwigEnvironment(new Twig_Environment($loader)); $debugbar-&gt;addCollector(new DebugBar\Bridge\Twig\TwigDataCollector($env)); You can provide a `DebugBar\DataCollector\TimeDataCollector` as the second argument of `TraceableTwigEnvironment` so render operation can be measured. "
});

View File

@ -72,11 +72,6 @@
</li>
<li>
<a href="/docs/data-collectors.html#base-collectors">Base collectors</a>
</li>
</ol>
@ -137,6 +132,52 @@
</ol>
</li>
<li>
<a href="/docs/base-collectors.html#base-collectors">Base collectors</a>
<ol>
<li>
<a href="/docs/base-collectors.html#messages">Messages</a>
</li>
<li>
<a href="/docs/base-collectors.html#timedata">TimeData</a>
</li>
<li>
<a href="/docs/base-collectors.html#exceptions">Exceptions</a>
</li>
<li>
<a href="/docs/base-collectors.html#pdo">PDO</a>
</li>
<li>
<a href="/docs/base-collectors.html#requestdatacollector">RequestDataCollector</a>
</li>
<li>
<a href="/docs/base-collectors.html#aggregatedcollector">AggregatedCollector</a>
</li>
<li>
<a href="/docs/base-collectors.html#others">Others</a>
</li>
</ol>
</li>
<li>
@ -145,6 +186,16 @@
<ol>
<li>
<a href="/docs/bridge-collectors.html#cachecache">CacheCache</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#doctrine">Doctrine</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#monolog">Monolog</a>
@ -155,6 +206,16 @@
</li>
<li>
<a href="/docs/bridge-collectors.html#slim">Slim</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#swift-mailer">Swift Mailer</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#twig">Twig</a>
@ -191,7 +252,21 @@ No more <code>var_dump()</code> in your code!</p>
<li>Includes generic data collectors and collectors for well known libraries</li>
<li>The client side bar is 100% coded in javascript</li>
<li>Easily create your own collectors and their associated view in the bar</li>
<li><a href="http://phpdebugbar.com/docs">Very well documented</a></li>
</ul>
<p>Includes collectors for:</p>
<ul>
<li><a href="http://php.net/manual/en/book.pdo.php">PDO</a></li>
<li><a href="http://maximebf.github.io/CacheCache/">CacheCache</a></li>
<li><a href="http://doctrine-project.org">Doctrine</a></li>
<li><a href="https://github.com/Seldaek/monolog">Monolog</a></li>
<li><a href="http://propelorm.org/">Propel</a></li>
<li><a href="http://slimframework.com">Slim</a></li>
<li><a href="http://swiftmailer.org/">Swift Mailer</a></li>
<li><a href="http://twig.sensiolabs.org/">Twig</a></li>
</ul>
<p>Checkout the <a href="https://github.com/maximebf/php-debugbar/tree/master/demo">demo</a> for
examples and <a href="http://phpdebugbar.com">phpdebugbar.com</a> for a live example.</p>
<a name="installation"></a><h2>Installation</h2>
<p>The easiest way to install DebugBar is using <a href="https://github.com/composer/composer">Composer</a>
with the following requirement:</p>
@ -235,7 +310,7 @@ $debugbar[&quot;messages&quot;]-&gt;addMessage(&quot;hello world!&quot;);
automated but others are manual. Use the <code>DebugBar</code> like an array where keys are the
collector names. In our previous example, we add a message to the <code>MessagesCollector</code>:</p>
<pre><code>$debugbar[&quot;messages&quot;]-&gt;addMessage(&quot;hello world!&quot;);</code></pre>
<p><code>StandardDebugBar</code> activates all bundled collectors:</p>
<p><code>StandardDebugBar</code> activates the following collectors:</p>
<ul>
<li><code>MemoryCollector</code> (<em>memory</em>)</li>
<li><code>MessagesCollector</code> (<em>messages</em>)</li>

View File

@ -72,11 +72,6 @@
</li>
<li>
<a href="/docs/data-collectors.html#base-collectors">Base collectors</a>
</li>
</ol>
@ -137,6 +132,52 @@
</ol>
</li>
<li>
<a href="/docs/base-collectors.html#base-collectors">Base collectors</a>
<ol>
<li>
<a href="/docs/base-collectors.html#messages">Messages</a>
</li>
<li>
<a href="/docs/base-collectors.html#timedata">TimeData</a>
</li>
<li>
<a href="/docs/base-collectors.html#exceptions">Exceptions</a>
</li>
<li>
<a href="/docs/base-collectors.html#pdo">PDO</a>
</li>
<li>
<a href="/docs/base-collectors.html#requestdatacollector">RequestDataCollector</a>
</li>
<li>
<a href="/docs/base-collectors.html#aggregatedcollector">AggregatedCollector</a>
</li>
<li>
<a href="/docs/base-collectors.html#others">Others</a>
</li>
</ol>
</li>
<li>
@ -145,6 +186,16 @@
<ol>
<li>
<a href="/docs/bridge-collectors.html#cachecache">CacheCache</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#doctrine">Doctrine</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#monolog">Monolog</a>
@ -155,6 +206,16 @@
</li>
<li>
<a href="/docs/bridge-collectors.html#slim">Slim</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#swift-mailer">Swift Mailer</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#twig">Twig</a>
@ -274,6 +335,8 @@ or indicator.</p>
&quot;map&quot; =&gt; &quot;messages&quot;,
&quot;default&quot; =&gt; &quot;[]&quot;
));</code></pre>
<p>You can disable a control using <code>disableControl($name)</code> and ignore any controls provided by
a collector using <code>ignoreCollector($name)</code>.</p>

View File

@ -72,11 +72,6 @@
</li>
<li>
<a href="/docs/data-collectors.html#base-collectors">Base collectors</a>
</li>
</ol>
@ -137,6 +132,52 @@
</ol>
</li>
<li>
<a href="/docs/base-collectors.html#base-collectors">Base collectors</a>
<ol>
<li>
<a href="/docs/base-collectors.html#messages">Messages</a>
</li>
<li>
<a href="/docs/base-collectors.html#timedata">TimeData</a>
</li>
<li>
<a href="/docs/base-collectors.html#exceptions">Exceptions</a>
</li>
<li>
<a href="/docs/base-collectors.html#pdo">PDO</a>
</li>
<li>
<a href="/docs/base-collectors.html#requestdatacollector">RequestDataCollector</a>
</li>
<li>
<a href="/docs/base-collectors.html#aggregatedcollector">AggregatedCollector</a>
</li>
<li>
<a href="/docs/base-collectors.html#others">Others</a>
</li>
</ol>
</li>
<li>
@ -145,6 +186,16 @@
<ol>
<li>
<a href="/docs/bridge-collectors.html#cachecache">CacheCache</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#doctrine">Doctrine</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#monolog">Monolog</a>
@ -155,6 +206,16 @@
</li>
<li>
<a href="/docs/bridge-collectors.html#slim">Slim</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#swift-mailer">Swift Mailer</a>
</li>
<li>
<a href="/docs/bridge-collectors.html#twig">Twig</a>

View File

@ -84,6 +84,7 @@ $debugbar[&quot;messages&quot;]-&gt;addMessage(&quot;hello world!&quot;);
<li>Includes generic data collectors and collectors for well known libraries</li>
<li>The client side bar is 100% coded in javascript</li>
<li>Easily create your own collectors and their associated view in the bar</li>
<li><a href="/docs">Very well documented</a></li>
</ul>
<div id="tryit">
Try it now at the bottom of the page!