hametuha / hamepub
PHP Library to handle ePub 3.0
Installs: 1 031
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 2
Requires
- php: >=7.2
- ext-dom: *
- ext-json: *
- masterminds/html5: 2.*
- minicli/minicli: >=2.0
Requires (Dev)
This package is auto-updated.
Last update: 2024-12-08 16:46:38 UTC
README
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:
dist
- 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
.
Resources
Below are important resources.
- ePub 3 Overview
- Mark Code List for Relators is the definition of
author
section.
Acknowledgement
The sample picture is credited by Public Domain Pictures and Nadi Lindsay.
License
This library is released under MIT.