Hello,
Since phpdocx 7, Premium licenses allow in-memory merging, but the Advanced license only allow to merge files. Using an Advanced license, you need to create the DOCX files and then merge them.
An in-memory merging sample using phpdocx 7 Premium is the following:
<?php
require_once 'classes/MultiMerge.inc';
CreateDocx::$returnDocxStructure = true;
// create the first document to be merged and return it as DOCX structure
$docx_a = new CreateDocx();
$text = 'Lorem ipsum dolor sit amet';
$docx_a->addText($text);
$document1 = $docx_a->createDocx();
// create the second document to be merged and return it as DOCX structure
$docx_b = new CreateDocx();
$text = 'Excepteur sint occaecat cupidatat non proident.';
$docx_b->addText($text);
$document2 = $docx_b->createDocx();
CreateDocx::$returnDocxStructure = false;
$merge = new MultiMerge();
$merge->mergeDocx($document1, array($document2), 'example_merge_docx_2.docx', array());
It can use CreateDocx and CreateDocxFromTemplate.
Regards.