PHPDOCX is a library that allows you to generate Microsoft .docx documents.        
PHPDOCX provides some standard features that you would commonly use when generating a document dynamically: managing  text, list, tables, images and graphic elements are all basic operations of document editing.
It does require some PHP extensions like “zip” and  “xsl” to work.