Mezon Html Report generator

Pros and cons

Installation

composer require mezon/html-report

Usage

$report = new Html();
// not that stylesheets are not validated, it is totally on your side
$report->head()->style()->selector('p')->css('color', 'red');
$report->head()->style()->selector('div')->css('color', 'green');;
$report->body()->p('Hello!');
$report->body()->div('World!');
// here we get HTML code in the variable $result
$result = $report->compile();

More complex examples

$table = $report->table();
$row = $table->tr();
$row->td()->innerHtml('#1');
$row->td()->innerHtml('Legolas');
$row->td()->innerHtml('#2');
$row->td()->innerHtml('Frodo');
$row->td()->innerHtml('#3');
$row->td()->innerHtml('Aragorn');

Supported tags

  • body
  • div
  • h1
  • h2
  • h3
  • h4
  • h5
  • head
  • p
  • strong
  • style
  • table
  • td
  • tr

Inner HTML

$report->body()->innerHtml('<script>alert(1);</scrip>');

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store