Open epub files in PHP

denied picture denied · Jun 29, 2011 · Viewed 7.7k times · Source

I want to open an .epub document with PHP, to modify it (for example to add some text on the first page and last page) and to save it back to .epub I found some classes for saving a text into epub file, but I can't find anything about opening an epub in PHP.

Answer

cweiske picture cweiske · Jun 29, 2011

epub files are just HTML+CSS files inside a ZIP archive (called the Open Container Format (OCF)) files with a different file extension :) So you can use PHP's ZipArchive class to work on the file.