I have downloaded phpdocx and I am testing my code on my local environment. I can successfully create a document from scratch with the following code:
$docx = new \Phpdocx\Create\CreateDocx();
$docx->addText('This is a test');
$docx->embedHTML('<p style="font-size: 30px;">New paragraph</p>');
$docx->createDocx(public_path() . '/output.docx');
However, I am needing to create a document from a template. Everytime I do so though I get the following error message: Error while trying to open the (base) template as a zip file
Here is my code:
$docx = new \Phpdocx\Create\CreateDocxFromTemplate(public_path() . '/Example Template.docx');
$variables = [
'1' => 'John',
'2' => 'Allen',
];
$docx->replaceVariableByText($variables);
$docx->createDocx(public_path() . '/output.docx');
Also, I am attaching a screenshot with more error details below: