iluckhack/xhprof-buggregator-bundle

Symfony 框架中的 Xhprof buggregator 集成

安装: 431

依赖: 0

建议者: 0

安全: 0

星标: 3

关注者: 1

分支: 2

公开问题: 0

类型:symfony-bundle

v0.1.0 2024-03-04 16:58 UTC

This package is auto-updated.

Last update: 2024-09-04 18:05:25 UTC


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)。请参阅 许可证文件 获取更多信息。