Skip to content

Commit 1bebbd1

Browse files
committed
Add examples for all savers
1 parent 17850bf commit 1bebbd1

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

examples/autoload.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,52 @@
3333
// Prefer 'upload' or 'file' saver.
3434
'save.handler' => Profiler::SAVER_UPLOAD,
3535

36+
// Saving profile data by upload is only recommended with HTTPS
37+
// endpoints that have IP whitelists applied.
38+
// https://github.com/perftools/php-profiler#upload-saver
39+
'save.handler.upload' => array(
40+
'uri' => 'https://example.com/run/import',
41+
// The timeout option is in seconds and defaults to 3 if unspecified.
42+
'timeout' => 3,
43+
// the token must match 'upload.token' config in XHGui
44+
'token' => 'token',
45+
),
46+
47+
// https://github.com/perftools/php-profiler#file-saver
48+
'save.handler.file' => array(
49+
// Appends jsonlines formatted data to this path
50+
'filename' => '/tmp/xhgui.data.jsonl',
51+
),
52+
53+
// https://github.com/perftools/php-profiler#stack-saver
54+
'save.handler.stack' => array(
55+
'savers' => array(
56+
Profiler::SAVER_UPLOAD,
57+
Profiler::SAVER_FILE,
58+
),
59+
// if saveAll=false, break the chain on successful save
60+
'saveAll' => false,
61+
),
62+
63+
// https://github.com/perftools/php-profiler#mongodb-saver
64+
'save.handler.mongodb' => array(
65+
'dsn' => 'mongodb://127.0.0.1:27017',
66+
'database' => 'xhprof',
67+
// Allows you to pass additional options like replicaSet to MongoClient.
68+
// 'username', 'password' and 'db' (where the user is added)
69+
'options' => array(),
70+
// Allows you to pass driver options like ca_file to MongoClient
71+
'driverOptions' => array(),
72+
),
73+
74+
// https://github.com/perftools/php-profiler#pdo-saver
75+
'save.handler.pdo' => array(
76+
'dsn' => 'sqlite:/tmp/xhgui.sqlite3',
77+
'user' => null,
78+
'pass' => null,
79+
'table' => 'results'
80+
),
81+
3682
// Environment variables to exclude from profiling data
3783
'profiler.exclude-env' => array(),
3884
'profiler.options' => array(),

0 commit comments

Comments
 (0)