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.
Via Composer
$ composer require cristiangomeze/template
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)'
Please see the changelog for more information on what has changed recently.
$ composer test
Please see contributing.md for details and a todolist.
If you discover any security related issues, please email author email instead of using the issue tracker.
license. Please see the license file for more information.