Hello,
Phpdocx supports dotm documents and allows adding macros, but the library doesn't run them (to run new macros using the conversion plugin you'd need to change the library adding new code). The macros will run when the document is open using MS Word (or other apps such as LibreOffice).
The available solutions to accomplish what you need are explained in our previous post.
Regards.