Skip to content

Commit 25b23bd

Browse files
committed
Add example init for zf1 plugin
1 parent ffd2522 commit 25b23bd

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

examples/zf1-plugin.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
use Xhgui\Profiler\Profiler;
4+
5+
function register_xhgui_plugin(Zend_Controller_Front $controller)
6+
{
7+
$config = new Zend_Config(array(
8+
/**
9+
* Determine whether the profiler should run.
10+
* This default implementation just disables the profiler.
11+
* Override this with your custom logic in your config
12+
* @return bool
13+
*/
14+
'profiler.enable' => function () {
15+
return true;
16+
},
17+
18+
// Saver to use.
19+
// Please note that 'pdo' and 'mongo' savers are deprecated
20+
// Prefer 'upload' or 'file' saver.
21+
'save.handler' => Profiler::SAVER_UPLOAD,
22+
23+
// Saving profile data by upload is only recommended with HTTPS
24+
// endpoints that have IP whitelists applied.
25+
// https://github.com/perftools/php-profiler#upload-saver
26+
'save.handler.upload' => array(
27+
'url' => 'https://example.com/run/import',
28+
// The timeout option is in seconds and defaults to 3 if unspecified.
29+
'timeout' => 3,
30+
// the token must match 'upload.token' config in XHGui
31+
'token' => 'token',
32+
),
33+
));
34+
35+
$controller->registerPlugin(new XhguiProfilerPlugin($config), 150);
36+
}

0 commit comments

Comments
 (0)