kduma / bulk-generator
Bulk Document Generator
dev-master
2021-11-14 22:54 UTC
Requires (Dev)
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2024-11-15 04:46:20 UTC
README
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.