glowieframework/debugger
Composer 安装命令:
composer require glowieframework/debugger
包简介
Glowie debug bar plugin
README 文档
README
Debugger is a plugin for Glowie Framework that provides a powerful and elegant debug bar for developers.
Features
- Clean and intuitive debug bar with zero configuration
- Log and filter messages, warnings, errors, and variables in a built-in console
- Capture and display exceptions with full stack traces
- Track long-running operations in a performance timeline
- Inspect Request and Response data, including headers
- View Session and Cookie information
- Log SQL queries with bindings and execution time
- Inspect rendered views, layouts, and their parameters
- Monitor application details such as routes, memory usage, software versions, request time, and more
- Automatic light and dark theme support
Installation
Install Debugger in your Glowie project using Composer:
composer require glowieframework/debugger
Then add the Debugger class to the plugins array in app/config/Config.php:
'plugins' => [ // ... other plugins here \Glowie\Plugins\Debugger\Debugger::class, ],
Next, add the Skeltch directive at the bottom of your main layout or desired view, just before the closing </body> tag:
<body> <!-- your page contents here --> { debugger } </body>
If you are not using the Skeltch templating engine, you can render the debug bar using the default PHP call:
<body>
<!-- your page contents here -->
<?php \Glowie\Plugins\Debugger\Debugger::render(); ?>
</body>
Debug mode
The debug bar should never be used in production. To enable it, the APP_DEBUG value in your .env file must be set to true.
APP_DEBUG=true
Make sure to disable this in your production environment.
Enabling or disabling the debug bar at runtime
You can control the debug bar rendering dynamically:
use Glowie\Plugins\Debugger\Debugger; Debugger::enable(); Debugger::disable();
Note: The
enable()method will have no effect if debug mode is disabled in your environment configuration.
Usage
Console window
Send messages to the console using the following methods:
use Glowie\Plugins\Debugger\Debugger; Debugger::log('Hello world!'); // Logs an info message // or Debugger::info('Hello world!'); Debugger::error('Something went wrong...'); // Logs an error message Debugger::warning('Remember to check the docs.'); // Logs a warning message Debugger::dump($myVar); // Dumps a variable to the console
Exceptions window
Capture exceptions and display them in the Exceptions tab:
use Glowie\Plugins\Debugger\Debugger; try { throw new Exception('Whoops!'); } catch (\Throwable $th) { Debugger::exception($th); throw $th; // re-throws the exception }
Timeline window
Measure execution time of operations:
use Glowie\Plugins\Debugger\Debugger; Debugger::startTimer('test', 'My timer description'); // long operation Debugger::stopTimer('test'); // or Debugger::measure('test', function(){ // long operation });
Cross-request data
By default, Debugger data is stored only for the current request. Each new request clears the previous information.
To persist debug data across requests:
use Glowie\Plugins\Debugger\Debugger; Debugger::startCapture(); // your Debugger calls here Debugger::stopCapture(); // or Debugger::capture(function(){ // your Debugger calls here });
Clearing information
You can clear specific sections of the debug bar:
use Glowie\Plugins\Debugger\Debugger; Debugger::clear(); // Clears the console Debugger::clearExceptions(); // Clears exceptions Debugger::clearTimers(); // Clears timers Debugger::clearQueries(); // Clears SQL queries
Credits
Debugger and Glowie are currently developed by Gabriel Silva.
glowieframework/debugger 适用场景与选型建议
glowieframework/debugger 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 51 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 02 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 glowieframework/debugger 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 glowieframework/debugger 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 51
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 32
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-02-23