arrayiterator / profiler
记录和代码分析
dev-main
2024-09-29 04:00 UTC
Requires
- php: >=7.4
- ext-json: *
Requires (Dev)
- phpstan/phpstan: ^1.12
- psr/http-message: ^1.0.1
- slevomat/coding-standard: ^8.15.0
- squizlabs/php_codesniffer: ^3.10.3
This package is auto-updated.
Last update: 2024-09-29 04:00:46 UTC
README
安装说明
composer require arrayiterator/profiler
分析
use ArrayIterator\Profiler\Profiler; $profiler = new Profiler(); // start the profiler $performance = $profiler->start('benchmark', 'Group Name', ['data' => 'information']); try { // do something with the code // write the code that you want to benchmark } finally { // best practice to stop the profiler using try -> finally // using finally to make sure the profiler is stopped $performance->stop(['additional' => 'information']); // or using profiler object // the group name is important when you have different group of benchmark // the group: default, as default group // the name of benchmark also important to identify the benchmark $profiler->stop('benchmark', 'Group Name', ['additional' => 'information']); }
渲染工具栏
/** * @var \ArrayIterator\Profiler\Profiler $profiler */ $waterfall = $profiler->getWaterfall(); // render the toolbar $darkMode = null; // set true if default dark mode or let it null when using autodetect $content = $waterfall->renderJs($darkMode); // can be echo or append to stream // echo $content; // append to stream interface (PSR-7) // $response->getBody()->write($content);
预览
注意
此包仍在开发中,分析器已准备好,但用户界面尚未准备好。用户界面仍在开发中。
但分析器已经可以使用,您可以通过安装包并使用分析器来使用它。您可以自定义前端或后端实现。
用户界面与渲染器实现
使用Typescript & scss [assets] 创建用户界面,用户界面使用以下技术创建
需求
- PHP 7.4 或更高版本
- Composer
- 开发环境 (Node.js (npm) - 用于安装依赖项)
任务
后端
- 基准分析器
- 内存分析器
- 时间分析器
- 渲染分析器
- 代码样式 & PhpStan
前端
- 工具栏(类似Chrome)
- 深色模式 & 亮色模式(自动检测)
- 可调整大小
- 响应式设计
- 操作大小
- 最大化
- 最小化(恢复)
- 关闭
- 基准标签
- 过滤
- 瀑布分析
- 导入器
- 导出器
- 恢复器
- 消息(关于导入、导出、恢复的信息)
- 输入搜索
- 水平可调整大小部分
- 信息标签
- 代码标签
基准标签
- 过滤
- 导入器
- 导出器
- 恢复器
- 消息(关于导入、导出、恢复的信息)
- 通用过滤器
- 性能过滤器(慢、快、平均)
- 搜索过滤器(跟随基准内容)
- 瀑布分析
- 使用瀑布使用div百分比
- 为某些表格添加附加信息
- 可点击以显示基准的详细信息
信息标签
- 分析器信息
- JSON元数据
- RAM使用量 & 限制(使用饼图从highchart.js生成的图表)
- 附加信息
- 基准图表(多种图表类型)
代码标签
- 代码部分
- 显示可折叠代码(json的前面)
依赖项
- 使用SquirrellyJS的模板引擎
- 使用HighChart的图表
- 使用HeroIcons的图标 & SVG
- 使用Webpack & TypeScript编译的JS
- 使用Sass编译的CSS