kduma/bulk-generator

dev-master 2021-11-14 22:54 UTC

This package is auto-updated.

Last update: 2024-10-15 04:37:54 UTC


README

Latest Version on Packagist Build Status Quality Score Total Downloads

Bulk Document Generator

Installation

You can install the package via composer:

composer require kduma/bulk-generator

Usage

use Kduma\BulkGenerator\ContentGenerators\SimpleTemplateWithPlaceholdersContentGenerator;
use Kduma\BulkGenerator\DataSources\CsvWithHeadersDataSource;
use Kduma\BulkGenerator\PdfGenerators\MpdfGenerator;
use Kduma\BulkGenerator\PageOptions\PageMargins;
use Kduma\BulkGenerator\PageOptions\PageSize;
use Kduma\BulkGenerator\BulkGenerator;

$dataSource = new CsvWithHeadersDataSource('data.csv');

$pdfGenerator = new MpdfGenerator(
    PageSize::fromName('A6', true),
    PageMargins::makeByAxis(5, 5)
);

$generator = (new BulkGenerator($dataSource, $pdfGenerator))
    ->setFrontTemplate('front_template.pdf')
    ->setFrontContentGenerator(new SimpleTemplateWithPlaceholdersContentGenerator('Hello {name}!'));

$generator->generate('output.pdf');

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email git@krystian.duma.sh instead of using the issue tracker.

Credits

License

The GNU GPLv3. Please see License File for more information.