承接 hametuha/hamepub 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hametuha/hamepub

Composer 安装命令:

composer require hametuha/hamepub

包简介

PHP Library to handle ePub 3.0

README 文档

README

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 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.

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 我们能提供哪些服务?
定制开发 / 二次开发

基于 hametuha/hamepub 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.33k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 9
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-06-01