You can also set these variables using a bash script.
\n#!/bin/bash\n\n# Set environment variables for var dumper\nexport VAR_DUMPER_FORMAT=\"server\"\nexport VAR_DUMPER_SERVER=\"127.0.0.1:9912\"For xhprof, it's a good idea to add a setup section for vanilla PHP applications. Thanks for the suggestion! It's not too hard. Just use the spiral-packages/profiler composer package.
Here's an example:
\nuse SpiralPackages\\Profiler\\Profiler;\nuse SpiralPackages\\Profiler\\Driver\\DriverInterface;\nuse SpiralPackages\\Profiler\\DriverFactory;\nuse SpiralPackages\\Profiler\\Storage\\StorageInterface;\nuse SpiralPackages\\Profiler\\Storage\\WebStorage;\nuse Symfony\\Component\\HttpClient\\NativeHttpClient;\n\n$storage = new WebStorage(\n new NativeHttpClient(),\n 'http://127.0.0.1/api/profiler/store',\n);\n\n$driver = DriverFactory::detect();\n\n$profiler = new Profiler(\n storage: $storage, \n driver: $driver, \n appName: 'My super app', \n tags: [\n // global tags\n 'env' => 'local'\n ]\n);\n\n$profiler->start(ignoredFunctions: []);\n\n// Here is your code you want to profile\n\n$profiler->end(tags: [\n // Tags for specific requests\n]);Hope this helps! If you need more details, let me know!
\n\n
It would be awesome if you could create a PR to the docs repository to improve the documentation for vanilla PHP users. Thanks a lot!
","upvoteCount":1,"url":"https://github.com/orgs/buggregator/discussions/206#discussioncomment-9816251"}}}How do I configure buggregator for a vanilla PHP app? #206
-
|
The documentation is quite sparse on information on how one would go about configuring xhprof and vardumper if you're just running a vanilla PHP application. The "configuration" sections probably only apply to the packages for Laravel and Spiral, unless I'm mistaken. A what levels of the stack would I need to integrate these systems and how would one go about it? I can't find much good documentation on xhprof |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
|
Hey! To configure var dumper for a vanilla PHP application, you just need to use Here's a quick example: // Plain PHP
$_SERVER['VAR_DUMPER_FORMAT'] = 'server';
$_SERVER['VAR_DUMPER_SERVER'] = '127.0.0.1:9912';You can also set these variables using a bash script. #!/bin/bash
# Set environment variables for var dumper
export VAR_DUMPER_FORMAT="server"
export VAR_DUMPER_SERVER="127.0.0.1:9912"For xhprof, it's a good idea to add a setup section for vanilla PHP applications. Thanks for the suggestion! It's not too hard. Just use the Here's an example: use SpiralPackages\Profiler\Profiler;
use SpiralPackages\Profiler\Driver\DriverInterface;
use SpiralPackages\Profiler\DriverFactory;
use SpiralPackages\Profiler\Storage\StorageInterface;
use SpiralPackages\Profiler\Storage\WebStorage;
use Symfony\Component\HttpClient\NativeHttpClient;
$storage = new WebStorage(
new NativeHttpClient(),
'http://127.0.0.1/api/profiler/store',
);
$driver = DriverFactory::detect();
$profiler = new Profiler(
storage: $storage,
driver: $driver,
appName: 'My super app',
tags: [
// global tags
'env' => 'local'
]
);
$profiler->start(ignoredFunctions: []);
// Here is your code you want to profile
$profiler->end(tags: [
// Tags for specific requests
]);Hope this helps! If you need more details, let me know! It would be awesome if you could create a PR to the docs repository to improve the documentation for vanilla PHP users. Thanks a lot! |
Beta Was this translation helpful? Give feedback.

Hey! To configure var dumper for a vanilla PHP application, you just need to use
$_SERVERvariables. Check this out: Var Dumper Configuration.Here's a quick example:
You can also set these variables using a bash script.
For xhprof, it's a good idea to add a setup section for vanilla PHP applications. Thanks for the suggestion! It's not too hard. Just use the
spiral-packages/profilercomposer package.Here's an example: