iluckhack / xhprof-buggregator-bundle
Symfony 框架中的 Xhprof buggregator 集成
v0.1.0
2024-03-04 16:58 UTC
Requires
- php: ^8.1
- spiral-packages/profiler: ^1.0
- symfony/config: >=6.4
- symfony/console: >=6.4
- symfony/dependency-injection: >=6.4
- symfony/event-dispatcher: >=6.4
- symfony/http-kernel: >=6.4
Requires (Dev)
- symfony/dotenv: >=6.4
- symfony/framework-bundle: >=6.4
- symfony/test-pack: ^1.1
- symfony/yaml: >=6.4
README
欢迎来到 Symfony 框架中 buggregator 的 Xhprof 集成包。此仓库允许您轻松地为您的 Symfony 应用程序启用 Xhprof 对 buggregator 的支持。
安装
要开始,请通过 composer 安装此包
composer require --dev iluckhack/xhprof-buggregator-bundle
您的包应该会被 Flex 自动启用。但这对开发环境来说很有用,所以您需要在 config/bundles.php 中进行修改
<?php // config/bundles.php return [ // ... Iluckhack\XhprofBuggregatorBundle\XhprofBuggregatorBundle::class => ['dev' => true], // ... ];
使用方法
您可以通过环境变量配置参数(例如,如果使用 .env
文件)
# ... # Your application name, it uses for providing to SpiralPackages\Profiler\Profiler XHPROF_BUGGREGATOR_APP_NAME="My awesome app" # Buggregator endpoint, it http://127.0.0.1:8000/api/profiler/store by default XHPROF_BUGGREGATOR_ENDPOINT=http://127.0.0.1:8123/api/profiler/store # If profiling enabled for CLI commands or HTTP requests respectively XHPROF_BUGGREGATOR_CLI_ENABLED=false XHPROF_BUGGREGATOR_HTTP_ENABLED=true # Custom header in your request to explicitly enable or disable profiling for that specific call # When this header is configured and present, it takes precedence over the "XHPROF_BUGGREGATOR_HTTP_ENABLED" variable XHPROF_BUGGREGATOR_HTTP_ENABLED_HEADER=X-Xhprof-Enabled # ...
当定义了 XHPROF_BUGGREGATOR_HTTP_ENABLED_HEADER
并且头部存在启用值时,值为 true
/1
/on
/yes
,否则将禁用分析。
默认值
XHPROF_BUGGREGATOR_APP_NAME="Symfony Application" XHPROF_BUGGREGATOR_ENDPOINT=http://127.0.0.1:8000/api/profiler/store XHPROF_BUGGREGATOR_CLI_ENABLED=false XHPROF_BUGGREGATOR_HTTP_ENABLED=false XHPROF_BUGGREGATOR_HTTP_ENABLED_HEADER=
测试
通过 composer 运行测试
composer tests
或直接运行
./vendor/bin/simple-phpunit
许可
MIT 许可证(MIT)。请参阅 许可证文件 获取更多信息。