It may be useful to create OpenXML documents (.docx, .xlsx, .pptx) in PHP.
OpenTBS is pure PHP tool that can build OpenXML documents using natural templates (i.e. templates that are real documents designed under MS Office). It is fully open source of course.
OpenTBS is a plug-in of the TinyButStrong template engine. It makes the fact that the OpenXML documents are actually embedded in a zip container invisible with multiple XML sub-files.
You can merge text of course, but also pictures, charts, tables, etc. The template engine is mature enough to support classic template features like data formating, conditional expressions, blocks, etc.
By the way, OpenTBS also merges OpenOffice documents.