kematjaya/export

2.3.2 2023-04-05 11:43 UTC

README

  1. instalation
composer require kematjaya/export
  1. render HTML to PDF
use Kematjaya\Export\Manager\ExportManager;
use Kematjaya\Export\Processor\PDF\DOMPDFProcessor;
....

$data = '<h1>test pdf</h1>';
$manager = new ExportManager();
$doc = $manager->render($data, new DOMPDFProcessor('doc.pdf'));
  1. render HTML to Excel
use Kematjaya\Export\Manager\ExportManager;
use Kematjaya\Export\Processor\Excel\HtmlToExcel;
....

$data = '<h1>test pdf</h1>';
$manager = new ExportManager();
$excel = $manager->render($data, new HtmlToExcel('doc.xls'));
  1. render array to excel
use Kematjaya\Export\Manager\ExportManager;
use Kematjaya\Export\Processor\Excel\PHPSpreadsheetProcessor;
....

$data = [
    ['a', 'b', 'c']
];
$manager = new ExportManager();
$excel = $manager->render($data, new PHPSpreadsheetProcessor());