PHPackages                             dmvdbrugge/epub-builder - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. dmvdbrugge/epub-builder

ActiveLibrary[File &amp; Storage](/categories/file-storage)

dmvdbrugge/epub-builder
=======================

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

v0.1.2(1y ago)231MITPHPPHP &gt;= 8.1

Since Sep 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/dmvdbrugge/php-epub-builder)[ Packagist](https://packagist.org/packages/dmvdbrugge/epub-builder)[ RSS](/packages/dmvdbrugge-epub-builder/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

EPUB Builder
============

[](#epub-builder)

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

Basic Usage
-----------

[](#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
    "The Early Years" => "The Early YearsI was youg and naive (...)"
        . "and that's how I ended up with my best friend.",
    "The One that Got Away" => "The One that Got AwayA lot of people have one,"
        . "(...) I still wonder sometimes, what if...",
    "Death and After" => "Death and AfterWhen I die (...) and that's that.",
];

$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-and-requirements)

Installation is just a [composer](https://getcomposer.org/) 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](composer.json) has the full requirements.

Documentation
-------------

[](#documentation)

Full documentation, among other things, is still [TODO](TODO.md).

License
-------

[](#license)

[MIT License](LICENSE)

Copyright (c) 2024 Dave van der Brugge

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~14 days

Total

3

Last Release

566d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/586b6465dccf2cfed642e89111b3084c3103618b1c53adba7387875e0860676e?d=identicon)[dmvdbrugge](/maintainers/dmvdbrugge)

---

Top Contributors

[![dmvdbrugge](https://avatars.githubusercontent.com/u/14186025?v=4)](https://github.com/dmvdbrugge "dmvdbrugge (19 commits)")

---

Tags

ebookepubereader-tools

### Embed Badge

![Health badge](/badges/dmvdbrugge-epub-builder/health.svg)

```
[![Health](https://phpackages.com/badges/dmvdbrugge-epub-builder/health.svg)](https://phpackages.com/packages/dmvdbrugge-epub-builder)
```

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M123](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M61](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
