mirror of
https://github.com/maximebf/php-debugbar.git
synced 2025-07-11 11:56:29 +02:00
updated docs
This commit is contained in:
@ -7,8 +7,11 @@ use DebugBar\StandardDebugBar;
|
|||||||
$debugbar = new StandardDebugBar();
|
$debugbar = new StandardDebugBar();
|
||||||
$debugbarRenderer = $debugbar->getJavascriptRenderer()->setBaseUrl('../src/DebugBar/Resources');
|
$debugbarRenderer = $debugbar->getJavascriptRenderer()->setBaseUrl('../src/DebugBar/Resources');
|
||||||
|
|
||||||
$debugbar->setStorage(new DebugBar\Storage\FileStorage(__DIR__ . '/profiles'));
|
//
|
||||||
$debugbarRenderer->setOpenHandlerUrl('open.php');
|
// create a writable profiles folder in the demo directory to uncomment the following lines
|
||||||
|
//
|
||||||
|
//$debugbar->setStorage(new DebugBar\Storage\FileStorage(__DIR__ . '/profiles'));
|
||||||
|
//$debugbarRenderer->setOpenHandlerUrl('open.php');
|
||||||
|
|
||||||
function render_demo_page(Closure $callback = null)
|
function render_demo_page(Closure $callback = null)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
# Javascript Bar
|
# Javascript Bar
|
||||||
|
|
||||||
|
**This section is here to document the inner workings of the client side debug bar.
|
||||||
|
Nothing described below is needed to run the debug bar in a normal way.**
|
||||||
|
|
||||||
The default client side implementation of the debug bar is made
|
The default client side implementation of the debug bar is made
|
||||||
entirely in Javascript and is located in the *debugbar.js* file.
|
entirely in Javascript and is located in the *debugbar.js* file.
|
||||||
|
|
||||||
@ -165,3 +168,14 @@ and indicators of type `PhpDebugBar.DebugBar.Indicator`. These classes subclass
|
|||||||
// ----
|
// ----
|
||||||
|
|
||||||
debugbar.addIndicator('phpdoc', new LinkIndicator({ href: 'http://doc.php.com', title: 'PHP doc' }));
|
debugbar.addIndicator('phpdoc', new LinkIndicator({ href: 'http://doc.php.com', title: 'PHP doc' }));
|
||||||
|
|
||||||
|
## OpenHandler
|
||||||
|
|
||||||
|
An OpenHandler object can be provided using `setOpenHandler()`. The object is in charge
|
||||||
|
of loading datasets. The only requirement is to provide a `show()` method which takes
|
||||||
|
as only parameter a callback which expects an id and data parameter.
|
||||||
|
|
||||||
|
The default implementation is `PhpDebugBar.OpenHandler` which must be use in conjonction
|
||||||
|
with the server side `DebugBar\OpenHandler` (see previous section).
|
||||||
|
|
||||||
|
debugbar.setOpenHandler(new PhpDebugBar.OpenHandler({ url: "open.php" }));
|
@ -9,6 +9,7 @@
|
|||||||
"base_collectors.md",
|
"base_collectors.md",
|
||||||
"bridge_collectors.md",
|
"bridge_collectors.md",
|
||||||
"storage.md",
|
"storage.md",
|
||||||
|
"openhandler.md",
|
||||||
"javascript_bar.md"
|
"javascript_bar.md"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
23
docs/openhandler.md
Normal file
23
docs/openhandler.md
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Open handler
|
||||||
|
|
||||||
|
The debug bar can open previous sets of collected data which were stored using
|
||||||
|
a storage handler (see previous section). To do so, it needs to be provided an
|
||||||
|
url to an open handler.
|
||||||
|
|
||||||
|
An open handler must respect a very simple protocol. The default implementation
|
||||||
|
is `DebugBar\OpenHandler`.
|
||||||
|
|
||||||
|
$openHandler = new DebugBar\OpenHandler($debugbar);
|
||||||
|
$openHandler->handle();
|
||||||
|
|
||||||
|
Calling `handle()` will use data from the `$_REQUEST` array and echo the output.
|
||||||
|
The function also supports input from other source if you provide an array as
|
||||||
|
first argument. It can also return the data instead of echoing (use false as
|
||||||
|
second argument) and not send the content-type header (use false as third argument).
|
||||||
|
|
||||||
|
One you have setup your open handler, tell the `JavascriptRenderer` its url.
|
||||||
|
|
||||||
|
$renderer->setOpenHandlerUrl('open.php');
|
||||||
|
|
||||||
|
This adds a button in the top right corner of the debug bar which allows you
|
||||||
|
to browse and open previous sets of collected data.
|
Reference in New Issue
Block a user