Skip to content
\n

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\"
\n

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.

\n

Here's an example:

\n
use 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]);
\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"}}}
Discussion options

You must be logged in to vote

Hey! To configure var dumper for a vanilla PHP application, you just need to use $_SERVER variables. Check this out: Var Dumper Configuration.

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 spiral-packages/profiler composer package.

Here's an example:

use SpiralPackages\Profiler\Profiler;

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@nsrosenqvist
Comment options

@butschster
Comment options

@nsrosenqvist
Comment options

@nsrosenqvist
Comment options

@nsrosenqvist
Comment options

Answer selected by butschster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
help wanted Extra attention is needed
2 participants