PHP Word : Template Processor

Two nice references

https://phpword.readthedocs.io/en/latest/templates-processing.html
https://hotexamples.com/examples/-/PhpOffice%255CPhpWord%255CTemplateProcessor/-/php-phpoffice%255cphpword%255ctemplateprocessor-class-examples.html

An example for using phpWord Templates can be found here: http://phpword.readthedocs.org/en/latest/templates.html

<?php
//https://phpword.readthedocs.io/en/latest/templates-processing.html
//https://hotexamples.com/examples/-/PhpOffice%255CPhpWord%255CTemplateProcessor/-/php-phpoffice%255cphpword%255ctemplateprocessor-class-examples.html
//https://stackoverflow.com/questions/16794294/phpword-doesnt-replace-text
//https://phpword.readthedocs.io/en/latest/intro.html
require_once 'vendor/autoload.php';
use PhpOffice\PhpWord\TemplateProcessor;
$templateProcessor = new TemplateProcessor('TemplateDoc.docx');// doc having place holders in the form ${placeHolder}
//__PETITTIONER_TYPE
$templateProcessor->setValue('placeHolder', 'Value Set for place holder');//${placeHolder} will be replaced with 'Value Set for place holder'
$templateProcessor->saveAs('placeHoldersReplaced.docx');
?>