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.
For more information please refer – http://www.phparch.com/2010/07/21/phpdocx-generating-word-documents-from-php/