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.10.1(8mo ago)91.0k↓33.3%5[1 issues](https://github.com/TypesetterIO/typesetter/issues)[1 PRs](https://github.com/TypesetterIO/typesetter/pulls)1MITPHPPHP ^8.2CI passing

Since May 29Pushed 8mo 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 1mo ago

READMEChangelog (1)Dependencies (10)Versions (18)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.1 or above.

`composer require typesetterio/typesetter`

Usage
-----

[](#usage)

Create a config array and pass that to the config maker. Then create a new instance of the Typesetter class. Call the generate method with your config to get a PDF binary return from MPDF.

Example:

```
$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\TypesetterCLI\Observers\FirstElementInChapterCSSClass(),
        new \Typesetterio\TypesetterCLI\Observers\BreakToPageBreak(),
        new \Typesetterio\TypesetterCLI\Observers\Credits(),
    ],
];

$config = new \Typsetterio\Typesetter\Config($config);
$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.

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

41

—

FairBetter than 89% of packages

Maintenance58

Moderate activity, may be stable

Popularity27

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity55

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 ~52 days

Recently: every ~101 days

Total

17

Last Release

252d ago

PHP version history (2 changes)0.1.0PHP ^8.1

0.10.1PHP ^8.2

### 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 (47 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

[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k144.3M712](/packages/maatwebsite-excel)[barryvdh/laravel-dompdf

A DOMPDF Wrapper for Laravel

7.3k87.6M278](/packages/barryvdh-laravel-dompdf)[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k24.8M48](/packages/barryvdh-laravel-snappy)[tightenco/jigsaw

Simple static sites with Laravel's Blade.

2.2k438.5k29](/packages/tightenco-jigsaw)[laravel-lang/publisher

Localization publisher for your Laravel application

2167.7M24](/packages/laravel-lang-publisher)[elibyy/tcpdf-laravel

tcpdf support for Laravel 6, 7, 8, 9, 10, 11

3542.7M5](/packages/elibyy-tcpdf-laravel)

PHPackages © 2026

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