dev-master
9999999-devSimple template engine for .docx
The Requires
- php >=5.4
- ext-zip *
The Development Requires
by Evgeny Ivanov
template word docx
Simple template engine for .docx
You can create a .docx template file with included search-patterns that can be replaced by any value you wish:, (*2)
<?php use DocxTemplate\TemplateFactory; $template = TemplateFactory::load('template1.docx'); $template->assign([ 'name' => 'Jon', 'surname' => 'Snow', 'house' => 'Stark' ]); $template->save('jon.docx');
Default search-pattern spelling is: {{mark_name}}
Mark name should be lowercase, with words separated by underscores., (*3)
My name is {{name}}.
Also you can use any search-pattern spelling you wish:, (*4)
<?php use DocxTemplate\TemplateFactory; TemplateFactory::useMarkSyntax('${', '}'); // prefix and suffix $template = TemplateFactory::load('template.docx');
Add to your composer.json
:, (*5)
{ "require" : { "tyz910/docx-templates": "*" } }
Simple template engine for .docx
template word docx