Hello,
The most common problem when getting a corrupted DOCX is that your server is not returning a correct mime type or your server is adding information to the document.
Please check the documentation available about how to download a DOCX file using phpdocx:
https://www.phpdocx.com/documentation/cookbook/download-generated-docx
phpdocx includes a createDocxAndDownload method to generate and download the documents, and you can try the alternative code available on the previous page. Premium licenses also include a stream mode to download the DOCX directly without saving the document to the filesystem.
And also please check this recent issue and how it was resolved:
https://www.phpdocx.com/en/forum/default/topic/1463
Regards.