Skip to content

cristiangomeze/Template

Repository files navigation

Template

Latest Version on Packagist Total Downloads

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages