cristiangomeze / template
Convert word templates to pdf
v0.0.12
2022-02-20 17:18 UTC
Requires
- illuminate/support: ^8.0|^9.0
- kwn/number-to-words: ^2.0
- phpoffice/phpword: ^0.18
- symfony/process: ^6.0
Requires (Dev)
- orchestra/testbench: ^6.0|^7.0
- sempro/phpunit-pretty-print: ^1.4
README
This is a wrapper to use the phpword template, which allows you to have the final document rendered in the browser. Take a look at contributing.md to see a to do list.
Installation
Via Composer
$ composer require cristiangomeze/template
Usage
use Cristiangomeze\Template\Template; $values = [ 'firstname' => 'John', 'lastname' => 'Doe' ]; $valuesImages = [ 'company_logo' => [ 'path' => '/home/user/wallpaper/wallpaper.png', 'width' => 200, 'height' => 200, 'ratio' => false ] ]; return Template::make('/home/user/any_word_document.docx') ->addValues($values) ->addImages($valuesImages) ->preview();
use Cristiangomeze\Template\Transforms\Transform; $values = [ [ 'key' => 'fecha', 'value' => '2019-08-08', 'transforms' => ['DateWords'] // DateWords, NumberWords, NumericFormat:2, DateFormat:LLLL ] ]; Transform::make($values)->toArray(); // 'fecha' => 'Ocho (8) Días del mes de Agosto del año Dos Mil Diecinueve (2019)'
Change log
Please see the changelog for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email author email instead of using the issue tracker.
Credits
License
license. Please see the license file for more information.