tobento/app-profiler
Composer 安装命令:
composer require tobento/app-profiler
包简介
App profiler.
README 文档
README
The profiler is a development tool that gives detailed information about the execution of a HTTP request or console commands if enabled in the config file.
Table of Contents
Getting Started
Add the latest version of the app profiler project running this command.
composer require tobento/app-profiler
Requirements
- PHP 8.4 or greater
Documentation
App
Check out the App Skeleton if you are using the skeleton.
You may also check out the App to learn more about the app in general.
Profiler Boot
The profiler boot does the following:
- installs and loads profiler config file
- implements interfaces based on config
- adds collectors based on config
- boots late profiler boot
- on response emit collects data from collectors and may inject the profiler toolbar
use Tobento\App\AppFactory; // Create the app $app = new AppFactory()->createApp(); // Add directories: $app->dirs() ->dir(realpath(__DIR__.'/../'), 'root') ->dir(realpath(__DIR__.'/../app/'), 'app') ->dir($app->dir('app').'config', 'config', group: 'config') ->dir($app->dir('root').'public', 'public') ->dir($app->dir('root').'vendor', 'vendor'); // Adding boots: $app->boot(\Tobento\App\Profiler\Boot\Profiler::class); // ... // Run the app: $app->run();
Profiler Config
The configuration for the profiler is located in the app/config/profiler.php file at the default App Skeleton config location where you can configure your profiler for your application.
Profiles
The profiler will inject a toolbar from the current profile into HTML responses only. Any AJAX requests will update the profiles selection in the toolbar where you can switch between them.
For other kinds of contents such as JSON responses, use the profiles page. Just browse the the /profiler/profiles URL to see all profiles.
Available Collectors
By default, all collectors are defined in the Profiler Config. Even if they are set, they will only collect data if the service they collect data from are installed. But you may uncomment the collector if not needed at all.
Boots Collector
This collector will show the currently booted boots in the order they were called as well as all registered boots.
In the app/config/profiler.php file:
'collectors' => [ \Tobento\App\Profiler\Collector\Boots::class, ],
Events Collector
If you have booted the App Event - Event Boot, this collector will show the currently dispatched events and listeners.
In the app/config/profiler.php file:
'collectors' => [ \Tobento\App\Profiler\Collector\Events::class, ],
Jobs Collector
If you have booted the App Queue - Queue Boot, this collector will show the currently pushed jobs.
In the app/config/profiler.php file:
'collectors' => [ \Tobento\App\Profiler\Collector\Jobs::class, ],
Logs Collector
If you have booted the App Logging - Logging Boot, this collector will show the currently logged messages from each logger specified.
In the app/config/profiler.php file:
'collectors' => [ \Tobento\App\Profiler\Collector\Logs::class, // or \Tobento\App\Profiler\Collector\Logs::class => [ // specify the logger names not to collect messages from: 'exceptLoggers' => ['null'], ], ],
Middleware Collector
If you have booted the App Http - Middleware Boot, this collector will show the currently dispatched middlewares as well as the available aliases.
In the app/config/profiler.php file:
'collectors' => [ \Tobento\App\Profiler\Collector\Middleware::class, ],
Request And Response Collector
If you have booted the App Http - Http Boot, this collector will show the current request and response data.
In the app/config/profiler.php file:
'collectors' => [ \Tobento\App\Profiler\Collector\RequestResponse::class, ],
Routes Collector
If you have booted the App Http - Routing Boot, this collector will show all registered routes.
In the app/config/profiler.php file:
'collectors' => [ \Tobento\App\Profiler\Collector\Routes::class, ],
Session Collector
If you have booted the App Http - Session Boot, this collector will show all session data.
In the app/config/profiler.php file:
'collectors' => [ \Tobento\App\Profiler\Collector\Session::class, // or: \Tobento\App\Profiler\Collector\Session::class => [ // specify the data you wont't to hide: 'hiddens' => [ '_session_flash_once', '_session_flash.old', ], ], ],
Storage Queries Collector
If you have booted the App Database - Database Boot, this collector will show all queries executed from any Storage Databases configured.
In the app/config/profiler.php file:
'collectors' => [ \Tobento\App\Profiler\Collector\StorageQueries::class, ],
Translation Collector
If you have booted the App Translation - Translation Boot, this collector will show all missed translations.
In the app/config/profiler.php file:
'collectors' => [ \Tobento\App\Profiler\Collector\Translation::class, ],
View Collector
If you have booted the App View - View Boot, this collector will show the currently rendered views and assets.
In the app/config/profiler.php file:
'collectors' => [ \Tobento\App\Profiler\Collector\View::class, // or you may configure only the data to collect: \Tobento\App\Profiler\Collector\View::class => [ 'collectViews' => true, 'collectAssets' => false, ], ],
Creating A Collector
You may create your own data collector by implementing the Tobento\App\Profiler\Collector\CollectorInterface or the Tobento\App\Profiler\Collector\LateCollectorInterface.
By implementing the CollectorInterface, the collector class will be created after the profiler gets booted, whereas the class implementing the LateCollectorInterface will be created after the late profiler boot gets booted.
I recommend investing the available collectors for its implementation.
Credits
tobento/app-profiler 适用场景与选型建议
tobento/app-profiler 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 43 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 05 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「package」 「profiler」 「app」 「tests」 「tobento」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tobento/app-profiler 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tobento/app-profiler 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 tobento/app-profiler 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
g4 application profiler package
Make your bundle an application
Simple ASCII output of array data
App Version Utility for CakePHP 2.x Applications
Profiler is a replica of Laravel Telescope modified for MongoDB.
统计信息
- 总下载量: 43
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 17
- 依赖项目数: 6
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-05-11