arkhee/simplepubgen
Composer 安装命令:
composer require arkhee/simplepubgen
包简介
Simple EPub Generator for PHP websites based on html content
README 文档
README
Create a simple texte based epub. This generator has been developped to be used as a library for a project aimed at producing simple epub based on websites, especially web novels. Basically, it can be used to generate an epub from a list of chapters that would have been collected (manually, automatically) from a website.
How it works
This software works completely on a programated way. It is a simple class that can be used in any PHP project.
- First instantiate the class with the following title of the book as a parameter
- Add a cover (url of the cover, the library will download it for you)
- Then add chapters to the book, with the title and the content of the chapter
- If there are more resources to add (images, css, etc), add them to the book with the addResource method
- Finally, call the
generatemethod to create the epub file
How the addResource works
The addResource method is used to add additional files to the epub that are called from the content of the chapters. This is useful for adding images, css, etc. You must first adapt the html of the content in order to modify the links. One image would initially look this way :
<img src="https://mysite/my-old-file.jpeg" />
You would have to changer it to this :
<img src="../image/new-file-name.jpeg" />
Then you can add the image to the epub with the following code :
$epub->addResource("new-file-name.jpeg","https://mysite/my-old-file.jpeg");
As you guessed the file will be stored in an "image" folder inside the ePub which is located in a different folder from the place contents are stored, so the "../image/" is important.
If you use the "WebBookScraper" class to collect the chapters, inline images will be automatically added to the epub and the content modified.
How to install
The project is available on packagist and can be installed using composer:
composer require "arkhee/simplepubgen"
Example
There is a sample provided to see how it works, have a look at the sample folder To use it as-is you must use the Simplepubgen and the WebBookScraper packages. Created a new folder on your server and copy the sample file at it's root Install both packages with composer and run the sample file.
composer require "arkhee/simplepubgen" composer require "arkhee/webbookscraper"
arkhee/simplepubgen 适用场景与选型建议
arkhee/simplepubgen 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 06 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 arkhee/simplepubgen 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 arkhee/simplepubgen 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2024-06-14