Mezon Html Report generator

Hi! Let me introduce eport generator wich I have created for personal use.

To be honest I don’t like create reports. It took soooooooo mcuh time. But this class now allows me to do it much faster.

Pros and cons

Mezon HTML report generator …


This content originally appeared on DEV Community and was authored by alexdodonov

Hi! Let me introduce eport generator wich I have created for personal use.

To be honest I don't like create reports. It took soooooooo mcuh time. But this class now allows me to do it much faster.

Pros and cons

Mezon HTML report generator allows you to create reports in a simple and pretty way. This tool also shortens time wich you spend on coding.

This package is a part of Mezon Framework

Installation

Just type:

composer require mezon/html-report

Usage

Lets start from creating object of the report generator:

$report = new Html();

And since that moment we can add elements to the head or body:

// 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

This example shows that every call creates new tag (except html and body). So if you want to add multyple tags then you need to store tag into variable:

$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

For now you can use following tags:

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

Inner HTML

If you need more tags, you can use innerHtml like in the example below:

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


This content originally appeared on DEV Community and was authored by alexdodonov


Print Share Comment Cite Upload Translate Updates
APA

alexdodonov | Sciencx (2021-11-22T16:27:46+00:00) Mezon Html Report generator. Retrieved from https://www.scien.cx/2021/11/22/mezon-html-report-generator/

MLA
" » Mezon Html Report generator." alexdodonov | Sciencx - Monday November 22, 2021, https://www.scien.cx/2021/11/22/mezon-html-report-generator/
HARVARD
alexdodonov | Sciencx Monday November 22, 2021 » Mezon Html Report generator., viewed ,<https://www.scien.cx/2021/11/22/mezon-html-report-generator/>
VANCOUVER
alexdodonov | Sciencx - » Mezon Html Report generator. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/11/22/mezon-html-report-generator/
CHICAGO
" » Mezon Html Report generator." alexdodonov | Sciencx - Accessed . https://www.scien.cx/2021/11/22/mezon-html-report-generator/
IEEE
" » Mezon Html Report generator." alexdodonov | Sciencx [Online]. Available: https://www.scien.cx/2021/11/22/mezon-html-report-generator/. [Accessed: ]
rf:citation
» Mezon Html Report generator | alexdodonov | Sciencx | https://www.scien.cx/2021/11/22/mezon-html-report-generator/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.