PHP Library to handle ePub 3.0

1.2.4 2023-04-08 13:02 UTC

This package is auto-updated.

Last update: 2024-07-08 15:35:59 UTC


GitHub actions for HamePub

HemePub's living example is hametuha. It's a WordPress site which is able to publish it's contents to ePub.

If you maintain PHP-based web apps, HamePub will help your multi-publishing.

NOTICE: HamePub means nothing sexual. I wrote like this, because it sounds meaningful in Japanese.(HamePubはePub作成のためのPHPライブラリであり、エッチな出来事が起きるパブではありません)

How to Install

Use composer.

composer require haemtuha/hamepub

How to Use

You can user HamePub for dynamic ePub generation, but suppose that you have a static HTML collection like below:

- index.html
- content.html
- colophon.html
- css
  - style.css
- img
  - cover.jpg
  - graph.jpg
  - barchart.png

Now we have CLI tool hamepub and you can run CLI command in your working directory.

# Dump setting file.
./vendor/bin/hamepub init setting.json

Next, edit JSON file like below:

    "root": "./dist/",
    "id": "my-first-ebook",
    "isbn": "1234567890123",
    "title": "My First Book",
    "author": "Fumiki Takahashi",
    "target": "./out",
    "published": "2023-01-01T23:00:00Z",
    "direction": "ltr",
    "cover": "./dist/img/cover.jpg"

Then, run command.

./bendor/bin/hamepub generate 

You will get ePub file my-first-ebook.epub.


Below are important resources.


The sample picture is credited by Public Domain Pictures and Nadi Lindsay.


This library is released under MIT.