1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-01-17 05:18:32 +01:00

updated doc

This commit is contained in:
maximebf 2013-08-12 12:02:32 +10:00
parent ff548cb579
commit 4196d76fa4
2 changed files with 39 additions and 6 deletions

View File

@ -73,18 +73,27 @@ This will have the result of adding a new indicator to the debug bar.
## Base collectors
Provided by the `DebugBar\DataCollector` namespace.
Cpllectors provided in the `DebugBar\DataCollector` namespace.
### 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->addCollector(new MessagesCollector());
$debugbar['message']->info('hello world');
$debugbar['messages']->info('hello world');
You can have multiple messages collector by naming them:
$debugbar->addCollector(new MessagesCollector('io_ops'));
$debugbar['io_ops']->info('opening files');
You can aggregate messages collector into other to have a unified view:
$debugbar['messages']->aggregate($debugbar['io_ops']);
### TimeData
Provides a way to log total execution time as well as taking "measures" (ie. measure the exution time of a particular operation).
Provides a way to log total execution time as well as taking "measures" (ie. measure the execution time of a particular operation).
$debugbar->addCollector(new TimeDataCollector());
@ -117,10 +126,31 @@ Logs SQL queries. You need to wrap your `PDO` object into a `DebugBar\DataCollec
$pdo = new PDO\TraceablePDO(new PDO('sqlite::memory:'));
$debugbar->addCollector(new PDO\PDOCollector($pdo));
### RequestDataCollector
Collects the data of PHP's global variables
$debugbar->addCollector(new RequestDataCollector());
### AggregatedCollector
Aggregates multiple collectors. Do not provide any widgets, you have to add your own controls.
$debugbar->addCollector(new AggregatedCollector('all_messages', 'messages', 'time'));
$debugbar['all_messages']->addCollector($debugbar['messages']);
$debugbar['all_messages']->addCollector(new MessagesCollector('mails'));
$debugbar['all_messages']['mails']->addMessage('sending mail');
$renderer = $debugbar->getJavascriptRenderer();
$renderer->addControl('all_messages', array(
'widget' => 'PhpDebugBar.Widgets.MessagesWidget',
'map' => 'all_messages',
'default' => '[]';
));
### Others
Misc collectors which you can just register:
- `MemoryCollector` (*memory*)
- `PhpInfoCollector` (*php*)
- `RequestDataCollector` (*request*)
- `MemoryCollector` (*memory*): Display memory usage
- `PhpInfoCollector` (*php*): PHP version number

View File

@ -125,3 +125,6 @@ or indicator.
"map" => "messages",
"default" => "[]"
));
You can disable a control using `disableControl($name)` and ignore any controls provided by
a collector using `ignoreCollector($name)`.