hametuha/hamepub
Composer 安装命令:
composer require hametuha/hamepub
包简介
PHP Library to handle ePub 3.0
关键字:
README 文档
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 use HamePub for dynamic ePub generation, but for clarification, 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 to default location (setting.json in project root). ./vendor/bin/hamepub init # Or specify a custom file path. ./vendor/bin/hamepub init file=my-setting.json
Next, edit JSON file like below:
{
"lang": "en",
"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",
"toc": "Table of Contents",
"header": {
"max_level": 3,
"depth": 2
},
"hidden": ["toc"]
}
Setting Options
| Key | Required | Description |
|---|---|---|
id |
Yes | Unique identifier for the ePub (used as filename). |
title |
Yes | Book title. |
author |
Yes | Author name (string) or array of author objects. |
published |
Yes | Publication date in ISO 8601 format (e.g., 2023-01-01T23:00:00Z). |
root |
No | Directory containing HTML files. Default: ./dist/ |
target |
No | Output directory for the ePub file. Default: ./tmp |
lang |
No | Language code. Default: en |
isbn |
No | ISBN number. |
direction |
No | Reading direction (ltr, rtl, or default). Default: default |
cover |
No | Path to cover image. |
toc |
No | Table of contents title. Default: Table of Contents |
header.max_level |
No | Maximum header level to include in TOC. Default: 3 |
header.depth |
No | Header depth. Default: 2 |
hidden |
No | Array of HTML file names (without extension) to hide from spine. Default: ["toc"] |
url_base |
No | Regex pattern for URL replacement in assets. Default: #\./#u |
guides |
No | Array of guide objects with type, href, and optional title. |
properties |
No | Object mapping HTML file names to arrays of properties. |
Then, run command.
# Generate ePub using default setting file (setting.json). ./vendor/bin/hamepub generate # Or specify a custom setting file. ./vendor/bin/hamepub generate file=my-setting.json # Specify a custom temporary directory. ./vendor/bin/hamepub generate tmp=./my-tmp-dir/
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
authorsection.
Acknowledgement
The sample picture is credited by Public Domain Pictures and Nadi Lindsay.
License
This library is released under MIT.
hametuha/hamepub 适用场景与选型建议
hametuha/hamepub 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.33k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2015 年 06 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「wordpress」 「epub」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hametuha/hamepub 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hametuha/hamepub 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hametuha/hamepub 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
php epub parser
Book publishing application
A PHP library for processing EPUB files.
Smart compressed files extractor
Just a little help for them. This is a Markdown dialect optimized for EPUB 3.
eBookLib with OPDS Catalog 1.1 support.
统计信息
- 总下载量: 1.33k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-06-01