kematjaya / export-bundle
help to export various format output
Installs: 1 730
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- kematjaya/export: ^2.0
- symfony/config: ^4.0|^5.0
- symfony/dependency-injection: ^4.0|^5.0
- symfony/framework-bundle: ^4.0|^5.0
- symfony/twig-bundle: ^4.0|^5.0
- symfony/yaml: ^4.0|^5.0
Requires (Dev)
- phpunit/phpunit: ^9.0
- symfony/browser-kit: ^4.0|^5.0
- symfony/var-dumper: ^4.0|^5.0
README
export module to excel, pdf, or etc for symfony app If you install this component outside of a Symfony application, you can use kematjaya/export
- installation
composer require kematjaya/export-bundle
- add to config/bundles.php
...
Kematjaya\ExportBundle\ExportBundle::class => ['all' => true]
...
- using inside Controller
// src/Controller/TestController.php
...
use Kematjaya\Export\Processor\Excel\PHPSpreadsheetProcessor; // convert array to excel document
use Kematjaya\Export\Processor\Excel\HtmlToExcel; // convert html to excel document
use Kematjaya\Export\Processor\PDF\DOMPDFProcessor; // convert html to PDF document
use Kematjaya\Export\Manager\ManagerInterface;
...
public function pdfDocument(ManagerInterface $exportManager)
{
// html to pdf
$pdf = $exportManager->render('<h3>TEST</h3>', new DOMPDFProcessor('doc.pdf'));
// html to excel
$htmlToExcel = $manager->render('<table></table>', new HtmlToExcel('doc.xls'));
// array to excel
$data = [
['a', 'b', 'c']
];
$arrayToExcel = $manager->render($data, new PHPSpreadsheetProcessor());
}
...