dmvdbrugge/epub-builder 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

dmvdbrugge/epub-builder

Composer 安装命令:

composer require dmvdbrugge/epub-builder

包简介

Package to help you build EPUB files from your own content.

README 文档

README

Easily transform your own content into EPUB files for reading on ereaders and book apps.

Basic Usage

// Step 1: Get your data from somewhere
$chapters = [
    // Title => Content; Content can be anything, as long as it's valid xhtml when added to a <body>
    "The Early Years" => "<h1>The Early Years</h1><p>I was youg and naive (...)"
        . "and that's how I ended up with my best friend.</p>",
    "The One that Got Away" => "<h1>The One that Got Away</h1><p>A lot of people have one,"
        . "(...) I still wonder sometimes, what if...</p>",
    "Death and After" => "<h1>Death and After</h1><p>When I die (...) and that's that.</p>",
];

$lastModified = \DateTimeImmutable::createFromFormat(DATE_ATOM, "2024-09-16T05:31:42+02:00");

// Step 2: Pass your data into an EpubBuilder and ->build() it
$epub = (new \DMvdBrugge\EpubBuilder\EpubBuilder())
    ->author("Me! Or You!")
    ->description("Life Stories to Learn From; or Not. You decide! This is the story of my life.")
    ->isbn("0-553-10354-7") // Not required but should be valid when provided
    ->identifier("my-awesome-website.com:book:9371") // Optional when ISBN provided
    ->language("en") // IETF language tag
    ->modified($lastModified)
    ->publisher("My Awesome Website")
    ->title("Life Stories to Learn From; or Not.")
    ->chapters($chapters)
    ->build();

// Step 3: Save somewhere...
copy($epub->getFileOnDisk(), "/home/user/books/{$epub->getFileName()}");

// ...or offer as download
// - Example 1: direct output
foreach ($epub->getHttpHeaders() as $header => $value) {
    header("{$header}: {$value}");
}

readfile($epub->getFileOnDisk());

// - Example 2: PSR-7 (f.e. Slim, $response exists)
foreach ($epub->getHttpHeaders() as $header => $value) {
    $response = $response->withHeader($header, $value);
}

$response = $response->withBody(new \Slim\Psr7\Stream($epub->getFileHandle()));

// Step 4: Go read your new EPUB

Installation and Requirements

Installation is just a composer call away.

composer require dmvdbrugge/epub-builder

Notable requirements: ext-zip, in the future probably also ext-simplexml to ensure valid xhtml.
As with any composer project, composer.json has the full requirements.

Documentation

Full documentation, among other things, is still TODO.

License

MIT License

Copyright (c) 2024 Dave van der Brugge

dmvdbrugge/epub-builder 适用场景与选型建议

dmvdbrugge/epub-builder 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 31 次下载、GitHub Stars 达 2, 最近一次更新时间为 2024 年 09 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 dmvdbrugge/epub-builder 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 dmvdbrugge/epub-builder 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 31
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 22
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-09-12