cdn77/tracy-blue-screen-bundle
Composer 安装命令:
composer require cdn77/tracy-blue-screen-bundle
包简介
This bundle lets you use the Tracy's debug screen in combination with the the default profiler in your Symfony application.
README 文档
README
This bundle lets you use the Tracy's debug screen in combination with the the default profiler in your Symfony application.
Why is Tracy's debug screen better than the Symfony default exception screen:
- You can browse all values of function call arguments.
- All information about the current request and environment.
- You can view all the information which is contained by the exception (e.g. private properties).
- Configurable links to files in stacktrace which can open directly in the IDE.
- Fullscreen layout providing more space for information.
- Look at the interactive example screen.
However, the Symfony profiler provides a lot of useful information about the application when an error occurs, so it is better to have them both available:
Console integration
To provide the same comfort while using Symfony Console this bundle will save a rendered BlueScreen to a file and show you a link for it. If you configure it, it will open the exception directly in your browser.
Usage
If you do not have any custom kernel.exception listeners this works out of the box. However, if you have any, you have to ensure that they do not return any response, because that prevents the profiler from showing up (the same applies for the default Symfony exception screen).
If you need to change the default position of this listener (see order in bin/console debug:event-dispatcher), use the configuration option listener_priority.
Console integration also works out of the box, if you do not have an console.error listener that would prevent execution of this one. Again, this can be tweaked using the respective listener_priority option.
Configure the browser option to open the exceptions directly in your browser, configured binary must be executable with exec().
If you want to configure your application to always convert warnings and notices to exceptions use the debug.error_handler.throw_at parameter (see PHP manual for other available values):
parameters: debug.error_handler.throw_at: -1
This bundle does not provide a dedicated logging functionality. If you want to use Tracy for logging e.g. in production use the monolog-tracy-bundle, which provides a Tracy Monolog handler.
Configuration
Configuration structure with listed default values:
# config/packages/tracy_blue_screen.yaml tracy_blue_screen: controller: # Enable debug screen for controllers. # Enabled by default only in dev environment with debug mode on. enabled: ~ # Priority with which the listener will be registered. listener_priority: 0 console: # Enable debug screen for console. # Enabled by default only in dev environment with debug mode on. enabled: ~ # Directory, where BlueScreens for console will be stored. # If you are already using Tracy for logging, set this to the same. # This will be only used, if given Tracy\Logger instance does not have a directory set. log_directory: '%kernel.logs_dir%' # Configure this to open generated BlueScreen in your browser. # Configuration option may be for example 'google-chrome' # or 'firefox'and it will be invoked as a shell command. browser: null # Priority with which the listener will be registered. listener_priority: 0 blue_screen: # Add paths which should be collapsed (for external/compiled code) so that actual error is expanded. collapse_paths: # Defaults: - '%kernel.project_dir%/bootstrap.php.cache' - '%kernel.cache_dir%' # plus paths set in BlueScreen instance used (/vendor) # Service ID of a callable(string $key, mixed $value, ?string $class): bool # that returns true for sensitive data to hide (passwords, tokens, API keys, etc.) scrubber: ~
Example scrubber implementation:
namespace App\Tracy; use Cdn77\TracyBlueScreenBundle\BlueScreen\TracyScrubber; final class SensitiveDataScrubber implements TracyScrubber { public function __invoke(string $key, mixed $value, string|null $class): bool { return preg_match('/(PASSWORD|SECRET|TOKEN|API_KEY|DSN)$/i', $key) === 1; } }
You can also override services used internally, for example if you need to specify options for the BlueScreen instance, you can provide custom instance with an alias:
services: my_blue_screen: class: 'Tracy\BlueScreen' properties: info: - 'environment: %kernel.environment%' cdn77.tracy_blue_screen.tracy.blue_screen: '@my_blue_screen'
Installation
Install package cdn77/tracy-blue-screen-bundle with Composer:
composer require cdn77/tracy-blue-screen-bundle
Register the bundle in your application:
// config/bundles.php return [ // ... Cdn77\TracyBlueScreenBundle\TracyBlueScreenBundle::class => ['all' => true], ];
cdn77/tracy-blue-screen-bundle 适用场景与选型建议
cdn77/tracy-blue-screen-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 105.9k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2021 年 01 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「debug」 「exceptions」 「error」 「bundle」 「debugger」 「tracy」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 cdn77/tracy-blue-screen-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cdn77/tracy-blue-screen-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 cdn77/tracy-blue-screen-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
php7ify is a project that brings new php7 classes and exceptions to php 5.x.
Debug your SimpleBus EventBus and CommandBus
nice output for debug functions for PHP 5.3
The CodenamePHP Platform core that contains basic interfaces, exceptions etc..
Analysis module for finding problematical shop data.
Twig extensions for Tracy Debugger
统计信息
- 总下载量: 105.9k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 32
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-01-11

