keruald/report

构建包含章节和条目的报告。支持Markdown、PHP对象和HTML输出。

0.1.0 2022-02-07 06:00 UTC

This package is auto-updated.

Last update: 2024-08-31 00:31:39 UTC


README

允许构建报告并输出。

报告框架

简介

报告是一组章节、一个通用标题和一些元数据。

章节是一组条目和一个标题。它们也可以被视为一本书的章节。

条目是文本和标题。

这给出了以下层次结构

Report                  title   (sections)     properties
  ReportSection         title   (entries)
    ReportEntry         title   text

一个完整示例可以在 tests/WithSampleReport.php 文件中找到。

简化报告

您可以使用仅使用 ReportSection 类构建简化版本

use Keruald\Reporting\ReportSection;

$report = new ReportSection("A simple report about historical geometric problems");
$report->push("Issue 1", "Can we square a circle?");
$report->push("Issue 2", "Can we divise an angle by 3?");
$report->push("Issue 2", "Can we double a cube?");

print_r($report);

输出

该库提供HTML和Markdown输出。

此类输出的示例可以在 tests/data 文件夹中找到。

这些输出类并非必须用于展示结果:报告数据结构可以很容易地通过 foreach 循环遍历以进行操作。

用途

keruald/healthcheck 库使用此报告库生成站点健康检查,并展示结果以帮助修复检测到的问题。