PHPackages                             indy2kro/php-epub - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. indy2kro/php-epub

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

indy2kro/php-epub
=================

A PHP library for processing EPUB files.

1.1.2(2mo ago)12.9k↓39.7%[1 PRs](https://github.com/indy2kro/php-epub/pulls)GPL-2.0-or-laterPHPPHP &gt;=8.3CI passing

Since Jan 23Pushed 1mo ago1 watchersCompare

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

READMEChangelog (9)Dependencies (14)Versions (14)Used By (0)

[![codecov](https://camo.githubusercontent.com/c4ab3580fbe27f9e6d497fba4d437475eb2788c9b581bb1bd96ea559ecfe0b0d/68747470733a2f2f636f6465636f762e696f2f67682f696e6479326b726f2f7068702d657075622f67726170682f62616467652e7376673f746f6b656e3d7467316e745174656249)](https://codecov.io/gh/indy2kro/php-epub) [![Tests](https://github.com/indy2kro/php-epub/actions/workflows/tests.yml/badge.svg)](https://github.com/indy2kro/php-epub/actions/workflows/tests.yml)

PHP EPUB Processor
==================

[](#php-epub-processor)

A PHP library for processing EPUB files, including parsing, metadata manipulation, and format conversion. This library provides tools to handle EPUB files efficiently, offering features like validation, content management, and conversion to other formats using various adapters.

- [Documentation](https://indy2kro.github.io/php-epub/)

Features
--------

[](#features)

- **EPUB Loading and Saving**: Easily load and save EPUB files.
- **Metadata Management**: Read and update metadata such as title, authors, and language.
- **Content Management**: Add, update, and delete content files within an EPUB.
- **Validation**: Validate the structure and content of EPUB files.
- **Conversion**: Convert EPUB files to PDF and other formats using adapters for TCPDF, Dompdf, and Calibre.

Installation
------------

[](#installation)

To install the library, use Composer:

```
composer require indy2kro/php-epub
```

Ensure that you have the necessary PHP extensions and optional libraries installed for full functionality:

- **Required**: `ext-xml`, `ext-zip`
- **Optional**: `dompdf/dompdf`, `tecnickcom/tcpdf` for PDF conversion, `Calibre` for mobi conversion

Usage
-----

[](#usage)

Loading an EPUB File:

```
use PhpEpub\EpubFile;

$epubFile = new EpubFile('/path/to/your.epub');
$epubFile->load();
```

Converting to PDF
-----------------

[](#converting-to-pdf)

Using TCPDF:

```
use PhpEpub\Converters\TCPDFAdapter;

$adapter = new TCPDFAdapter();
$adapter->convert('/path/to/extracted/epub', '/path/to/output.pdf');
```

Managing Metadata
-----------------

[](#managing-metadata)

```
use PhpEpub\Metadata;
use PhpEpub\EpubFile;

$epubFilePath = '/path/to/your.epub';

$epubFile = new EpubFile($epubFilePath);
$epubFile->load();

$metadata = $epubFile->getMetadata();
$title = $metadata->getTitle();
$metadata->setTitle('New Title');
$metadata->save();

$epubFile->save();
```

Code Quality
------------

[](#code-quality)

To maintain high standards of code quality, this project uses several tools:

- **PHPUnit**: Run tests with `vendor/bin/phpunit`
- **PHP CodeSniffer (PHPCS)**: Ensures code adheres to coding standards:

```
vendor/bin/phpcs src/ tests/
```

- **PHPStan**: Static analysis tool for finding bugs:

```
php -d memory_limit=512M vendor/bin/phpstan analyse --no-progress
```

- **Rector**: Automated code refactoring and upgrades:

```
vendor/bin/rector
```

### Running All Code Quality Checks

[](#running-all-code-quality-checks)

Run all code quality tools at once:

```
# Using composer script (recommended)
composer quality

# Or run individually
vendor/bin/phpunit && vendor/bin/phpcs src/ tests/ && php -d memory_limit=512M vendor/bin/phpstan analyse --no-progress
```

AI Integration
--------------

[](#ai-integration)

This project is designed for easy integration with AI coding assistants:

- **AGENTS.md**: Contains instructions for AI agents working on this codebase
- **Consistent class structure**: Key classes (`EpubFile`, `Metadata`, `ContentManager`, etc.) follow predictable patterns
- **Dependency injection**: Core classes accept optional dependencies in constructors for easier mocking
- **Type hints**: All methods use PHP 8+ type hints for better AI understanding

Testing
-------

[](#testing)

To run the tests, use PHPUnit:

```
vendor/bin/phpunit
```

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance89

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 66.8% 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 ~52 days

Recently: every ~103 days

Total

9

Last Release

63d ago

Major Versions

0.1.1 → 1.0.02025-02-08

PHP version history (2 changes)0.0.1PHP &gt;=8.2

1.1.1PHP &gt;=8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1812715?v=4)[Cristi Radu](/maintainers/indy2kro)[@indy2kro](https://github.com/indy2kro)

---

Top Contributors

[![indy2kro](https://avatars.githubusercontent.com/u/1812715?v=4)](https://github.com/indy2kro "indy2kro (155 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (77 commits)")

---

Tags

booksepublibraryepub

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/indy2kro-php-epub/health.svg)

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

###  Alternatives

[league/iso3166

ISO 3166-1 PHP Library

70036.3M116](/packages/league-iso3166)[league/statsd

A simple library for working with StatsD in PHP.

3514.3M12](/packages/league-statsd)[payum/iso4217

ISO 4217 PHP Library

16312.1M5](/packages/payum-iso4217)[lambdish/phunctional

λ PHP functional library

3612.0M23](/packages/lambdish-phunctional)[dekor/php-array-table

PHP Library for printing associative arrays as text table (similar to mysql terminal console)

296.6M2](/packages/dekor-php-array-table)

PHPackages © 2026

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