Skip to content

Commit ff4561f

Browse files
committed
updated docs
1 parent 3690180 commit ff4561f

File tree

4 files changed

+43
-2
lines changed

4 files changed

+43
-2
lines changed

demo/bootstrap.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77
$debugbar = new StandardDebugBar();
88
$debugbarRenderer = $debugbar->getJavascriptRenderer()->setBaseUrl('../src/DebugBar/Resources');
99

10-
$debugbar->setStorage(new DebugBar\Storage\FileStorage(__DIR__ . '/profiles'));
11-
$debugbarRenderer->setOpenHandlerUrl('open.php');
10+
//
11+
// create a writable profiles folder in the demo directory to uncomment the following lines
12+
//
13+
//$debugbar->setStorage(new DebugBar\Storage\FileStorage(__DIR__ . '/profiles'));
14+
//$debugbarRenderer->setOpenHandlerUrl('open.php');
1215

1316
function render_demo_page(Closure $callback = null)
1417
{

docs/javascript_bar.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Javascript Bar
22

3+
**This section is here to document the inner workings of the client side debug bar.
4+
Nothing described below is needed to run the debug bar in a normal way.**
5+
36
The default client side implementation of the debug bar is made
47
entirely in Javascript and is located in the *debugbar.js* file.
58

@@ -165,3 +168,14 @@ and indicators of type `PhpDebugBar.DebugBar.Indicator`. These classes subclass
165168
// ----
166169

167170
debugbar.addIndicator('phpdoc', new LinkIndicator({ href: 'http://doc.php.com', title: 'PHP doc' }));
171+
172+
## OpenHandler
173+
174+
An OpenHandler object can be provided using `setOpenHandler()`. The object is in charge
175+
of loading datasets. The only requirement is to provide a `show()` method which takes
176+
as only parameter a callback which expects an id and data parameter.
177+
178+
The default implementation is `PhpDebugBar.OpenHandler` which must be use in conjonction
179+
with the server side `DebugBar\OpenHandler` (see previous section).
180+
181+
debugbar.setOpenHandler(new PhpDebugBar.OpenHandler({ url: "open.php" }));

docs/manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"base_collectors.md",
1010
"bridge_collectors.md",
1111
"storage.md",
12+
"openhandler.md",
1213
"javascript_bar.md"
1314
]
1415
}

docs/openhandler.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Open handler
2+
3+
The debug bar can open previous sets of collected data which were stored using
4+
a storage handler (see previous section). To do so, it needs to be provided an
5+
url to an open handler.
6+
7+
An open handler must respect a very simple protocol. The default implementation
8+
is `DebugBar\OpenHandler`.
9+
10+
$openHandler = new DebugBar\OpenHandler($debugbar);
11+
$openHandler->handle();
12+
13+
Calling `handle()` will use data from the `$_REQUEST` array and echo the output.
14+
The function also supports input from other source if you provide an array as
15+
first argument. It can also return the data instead of echoing (use false as
16+
second argument) and not send the content-type header (use false as third argument).
17+
18+
One you have setup your open handler, tell the `JavascriptRenderer` its url.
19+
20+
$renderer->setOpenHandlerUrl('open.php');
21+
22+
This adds a button in the top right corner of the debug bar which allows you
23+
to browse and open previous sets of collected data.

0 commit comments

Comments
 (0)