Hello,
The method replaceVariableByText (http://www.phpdocx.com/api-documentation/templates/replace-variable-text-Word-document) allows to replace one or more placeholders. Note that you need to set the target parameter to replace placeholders in headers.
Regards.