PHPackages                             wallabag/php-mobi - 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. wallabag/php-mobi

AbandonedArchivedLibrary

wallabag/php-mobi
=================

A Mobipocket file (.mobi) creator in PHP.

1.1.1(4y ago)11196.4k↓41.7%6[3 issues](https://github.com/wallabag/php-mobi/issues)1Apache-2.0PHPPHP &gt;=5.3.0

Since Jan 19Pushed 4y ago2 watchersCompare

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

READMEChangelog (4)Dependencies (1)Versions (6)Used By (1)

phpMobi file generator
======================

[](#phpmobi-file-generator)

phpMobi is a php script that can generate .mobi files from valid html files. While this was meant as an experiment, this tool works quite well and can be used to generate mobipocket files from most news articles.

IMPORTANT: Do NOT use this on a public web server: most of it was coded in a weekend, with no testing and no special attention to security. Also, as no official documentation for the MOBI file format is available, there will be some bugs/problems in the generated files, but it works for relatively simple documents on the Kindle previewer and the Kindle 3.

MobiPocket is an eBook format created by Mobipocket SA. This tool also uses a php readability port made by [Keyvan Minoukadeh](http://www.keyvan.net/2010/08/php-readability/).

Code sample
-----------

[](#code-sample)

See index.php for an example of using this program.

Sending an online article as a download:

```
// Create the MOBI object
$mobi = new MOBI();

// Set the content provider
$content = new OnlineArticle('URL');
$mobi->setContentProvider($content);

// Get title and make it a 12 character long url-safe filename
$title = $mobi->getTitle();
if ($title === false) {
    $title = 'file';
}

$title = urlencode(str_replace(' ', '_', strtolower(substr($title, 0, 12))));

// Send the mobi file as download
$mobi->download($title.'.mobi');
```

Using a previously generated/downloaded html file (will not download any images!):

```
$data = '...';
$options = array(
    'title' => 'Local document',
    'author' => 'Author name',
    'subject' => 'Subject'
);

// Create the MOBI object
$mobi = new MOBI();

// Set the data
$mobi->setData($data);
$mobi->setOptions($options);

// Save the mobi file locally
$mobi->save($options['title'].'.mobi');
```

Implementation
--------------

[](#implementation)

This code was implemented while reverse-engineering the MobiPocket format. Therefore this code absolutely isn't optimized for speed, but rather for easy changes, as getting it to produce valid files was quite fiddly.

Features
--------

[](#features)

Modular content provider system: Adding a new data source can be done by extending the ContentProvider class. See the OnlineArticle class for a simple but complete implementation of such a system.

Image support: By default, the online article downloader (and any other content provider that supports images) will download images and integrate them into the mobi file.

Partial UTF-8 support: In practice UTF-8 just works, but there are some unhandled corner cases (see missing features).

Missing Features
----------------

[](#missing-features)

Compression: This won't be implemented (or if it is, only to serve as a reference of the format).

Different eBook types: MobiPocket supports other formats/layouts, such as newspaper-like formats. At the moment only the book layout has been implemented.

Full UTF-8 support: UTF-8 should work most of the time (it worked every time I tested it), but there might be some problems when the character is split over two "records".

License
-------

[](#license)

This code is released under the Apache license (version 2.0)

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity40

Moderate usage in the ecosystem

Community20

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 68.4% 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 ~654 days

Total

5

Last Release

1519d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/57fabcfbe3c772be6acc02eb7117d6e0c003a75bc25cc42535412db4e11902cf?d=identicon)[j0k3r](/maintainers/j0k3r)

![](https://www.gravatar.com/avatar/b2919c3e1996b6ab5cb88d77183334f92c4ae8318e02860bd04320c3d6628147?d=identicon)[nicosomb](/maintainers/nicosomb)

---

Top Contributors

[![raiju](https://avatars.githubusercontent.com/u/806013?v=4)](https://github.com/raiju "raiju (26 commits)")[![j0k3r](https://avatars.githubusercontent.com/u/62333?v=4)](https://github.com/j0k3r "j0k3r (4 commits)")[![nicosomb](https://avatars.githubusercontent.com/u/121870?v=4)](https://github.com/nicosomb "nicosomb (4 commits)")[![DawsonG](https://avatars.githubusercontent.com/u/2425837?v=4)](https://github.com/DawsonG "DawsonG (2 commits)")[![Kdecherf](https://avatars.githubusercontent.com/u/226063?v=4)](https://github.com/Kdecherf "Kdecherf (2 commits)")

### Embed Badge

![Health badge](/badges/wallabag-php-mobi/health.svg)

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

###  Alternatives

[symfony/console

Eases the creation of beautiful and testable command line interfaces

9.8k1.1B11.3k](/packages/symfony-console)[symfony/symfony

The Symfony PHP framework

31.3k86.3M2.2k](/packages/symfony-symfony)[symfony/http-foundation

Defines an object-oriented layer for the HTTP specification

8.6k877.8M5.2k](/packages/symfony-http-foundation)[symfony/var-dumper

Provides mechanisms for walking through any arbitrary PHP variable

7.4k855.5M8.0k](/packages/symfony-var-dumper)[symfony/translation

Provides tools to internationalize your application

6.6k836.5M2.1k](/packages/symfony-translation)[twig/twig

Twig, the flexible, fast, and secure template language for PHP

8.4k443.2M5.8k](/packages/twig-twig)

PHPackages © 2026

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