PHPackages                             typesetterio/typesetter - 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. [PDF &amp; Document Generation](/categories/documents)
4. /
5. typesetterio/typesetter

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

typesetterio/typesetter
=======================

The main typesetter service for generating PDFs from Markdown for ebooks.

0.11.0(2mo ago)81.9k↑664.3%5[4 issues](https://github.com/TypesetterIO/typesetter/issues)1MITPHPPHP ^8.3CI passing

Since May 29Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/TypesetterIO/typesetter)[ Packagist](https://packagist.org/packages/typesetterio/typesetter)[ Docs](https://typesetter.io)[ GitHub Sponsors](https://github.com/aaronsaray)[ RSS](/packages/typesetterio-typesetter/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (1)Dependencies (20)Versions (20)Used By (1)

 [![](.github/assets/logo.png)](.github/assets/logo.png)

 [![License](https://camo.githubusercontent.com/752d841d33d5767467cc8a03c86bf09d5a8b47a49262a9434883da7cba234f3c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f74797065736574746572696f2f747970657365747465723f6c6162656c436f6c6f723d65376535653426636f6c6f723d323932353234)](https://camo.githubusercontent.com/752d841d33d5767467cc8a03c86bf09d5a8b47a49262a9434883da7cba234f3c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f74797065736574746572696f2f747970657365747465723f6c6162656c436f6c6f723d65376535653426636f6c6f723d323932353234) [![Packagist](https://camo.githubusercontent.com/f05ad10a9def77491698471728b5fc780ee8d12792c4435ad88e920216019e16/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f74797065736574746572696f2f747970657365747465723f6c6162656c436f6c6f723d65376535653426636f6c6f723d323932353234)](https://camo.githubusercontent.com/f05ad10a9def77491698471728b5fc780ee8d12792c4435ad88e920216019e16/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f74797065736574746572696f2f747970657365747465723f6c6162656c436f6c6f723d65376535653426636f6c6f723d323932353234) [![GitHub Workflow Status](https://camo.githubusercontent.com/82e229312a436a7dd41d535832872ae3b0eee0b063459972713edecfe18c0c2f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f74797065736574746572696f2f747970657365747465722f63692e796d6c3f6c6162656c436f6c6f723d65376535653426636f6c6f723d323932353234)](https://camo.githubusercontent.com/82e229312a436a7dd41d535832872ae3b0eee0b063459972713edecfe18c0c2f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f74797065736574746572696f2f747970657365747465722f63692e796d6c3f6c6162656c436f6c6f723d65376535653426636f6c6f723d323932353234)

Typesetter
==========

[](#typesetter)

This is the Typesetter main service. This can be used in your own projects directly if you want. You probably want to head over to [typesetter-cli](https://github.com/typesetterio/typesetter-cli) though.

Install
-------

[](#install)

This requires PHP 8.3 or above.

`composer require typesetterio/typesetter`

Usage
-----

[](#usage)

Build a `Config` from an array of options, then pass it to `Typesetter::generate()` to get a PDF binary back from MPDF.

Example:

```
$config = new \Typesetterio\Typesetter\Config([
    'title' => 'Benjamin Button',
    'author' => 'F. Scott Fitzgerald',
    'theme' => 'bb',

    'toc-enabled' => true,
    'toc-links' => true,
    'toc-header' => 'Table of Contents',

    'footer' => '{PAGENO}',

    'markdown-extensions' => ['md', 'markdown'],
    'observers' => [
        new \Typesetterio\Typesetter\Observers\DefaultMarkdownConfiguration(),
        new \Typesetterio\Typesetter\Observers\FirstElementInChapterCSSClass(),
        new \Typesetterio\Typesetter\Observers\BreakToPageBreak(),
        new \Typesetterio\Typesetter\Observers\Credits(),
    ],
]);

$service = new \Typesetterio\Typesetter\Typesetter();
$pdfContent = $service->generate($config);
file_put_contents('my-pdf.pdf', $pdfContent);
```

To learn more, please check out the [documentation](https://typesetter.io). This details configuration, customization, themes and cover generation, observers, listeners and more.

Demo
----

[](#demo)

The `demo/` directory contains a runnable example used for manual smoke testing. It includes a small theme, three Markdown chapters that exercise each bundled observer, and `demo/run.php`, which generates a PDF at `demo/output.pdf` (gitignored). Run it from the project root with `php demo/run.php`.

Credits
-------

[](#credits)

This was heavily influenced by the [Ibis](https://github.com/themsaid/ibis) project but is a complete rewrite.

This package stands on the shoulders of giants like [MPDF](https://mpdf.github.io/), some parts of [Laravel](https://laravel.com) and also the [League Commonmark](https://commonmark.thephpleague.com/) library.

[Aaron Saray](https://aaronsaray.com) is the primary author and maintainer.

###  Health Score

48

—

FairBetter than 93% of packages

Maintenance77

Regular maintenance activity

Popularity30

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98% 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 ~63 days

Recently: every ~144 days

Total

18

Last Release

65d ago

PHP version history (3 changes)0.1.0PHP ^8.1

0.10.1PHP ^8.2

0.11.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/5a9ad2a426eb84bbb6d5fd7f8a9000797796581c2aeda0d27b39391e55c0e7a3?d=identicon)[aaronsaray](/maintainers/aaronsaray)

---

Top Contributors

[![aaronsaray](https://avatars.githubusercontent.com/u/956888?v=4)](https://github.com/aaronsaray "aaronsaray (49 commits)")[![rampmaster](https://avatars.githubusercontent.com/u/978024?v=4)](https://github.com/rampmaster "rampmaster (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/typesetterio-typesetter/health.svg)

```
[![Health](https://phpackages.com/badges/typesetterio-typesetter/health.svg)](https://phpackages.com/packages/typesetterio-typesetter)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[illuminate/mail

The Illuminate Mail package.

5910.6M501](/packages/illuminate-mail)[illuminate/database

The Illuminate Database package.

2.8k54.9M11.6k](/packages/illuminate-database)[illuminate/filesystem

The Illuminate Filesystem package.

16165.1M3.2k](/packages/illuminate-filesystem)[illuminate/view

The Illuminate View package.

13047.0M2.2k](/packages/illuminate-view)[illuminate/console

The Illuminate Console package.

13046.0M6.5k](/packages/illuminate-console)

PHPackages © 2026

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