PHPackages                             mprince2k18/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. mprince2k18/typesetter

ActiveLibrary

mprince2k18/typesetter
======================

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

11PHP

Since Feb 10Pushed 2y agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

 [![](https://github.com/TypesetterIO/assets/raw/main/logos/v1/logo.png)](https://github.com/TypesetterIO/assets/blob/main/logos/v1/logo.png)

[![License](https://camo.githubusercontent.com/a4c6e173494dc4b075938207d85b5712fae408ef278f6538a214f486b1f80a2a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f74797065736574746572696f2f747970657365747465723f6c6162656c436f6c6f723d35613934626426636f6c6f723d303033343563)](https://camo.githubusercontent.com/a4c6e173494dc4b075938207d85b5712fae408ef278f6538a214f486b1f80a2a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f74797065736574746572696f2f747970657365747465723f6c6162656c436f6c6f723d35613934626426636f6c6f723d303033343563)[![Packagist Downloads](https://camo.githubusercontent.com/5f874ef91f065c734ab014f938cd0ff7bfe249e0f7324629405b10707fd0b68b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f74797065736574746572696f2f747970657365747465723f6c6162656c436f6c6f723d35613934626426636f6c6f723d303033343563)](https://camo.githubusercontent.com/5f874ef91f065c734ab014f938cd0ff7bfe249e0f7324629405b10707fd0b68b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f74797065736574746572696f2f747970657365747465723f6c6162656c436f6c6f723d35613934626426636f6c6f723d303033343563)[![Github Workflow Status](https://camo.githubusercontent.com/55e40d614d2ab838bb3088ce5c9bcf7d83ca192c798586f4882e06f5137d6068/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f74797065736574746572696f2f747970657365747465722f63692e796d6c3f6c6162656c436f6c6f723d35613934626426636f6c6f723d303033343563)](https://camo.githubusercontent.com/55e40d614d2ab838bb3088ce5c9bcf7d83ca192c798586f4882e06f5137d6068/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f74797065736574746572696f2f747970657365747465722f63692e796d6c3f6c6162656c436f6c6f723d35613934626426636f6c6f723d303033343563)

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://docs.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

13

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity19

Early-stage or recently created project

 Bus Factor1

Top contributor holds 93.5% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/43857625?v=4)[Mohammad Prince](/maintainers/mprince2k18)[@mprince2k18](https://github.com/mprince2k18)

---

Top Contributors

[![aaronsaray](https://avatars.githubusercontent.com/u/956888?v=4)](https://github.com/aaronsaray "aaronsaray (29 commits)")[![mprince2k18](https://avatars.githubusercontent.com/u/43857625?v=4)](https://github.com/mprince2k18 "mprince2k18 (2 commits)")

### Embed Badge

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

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

PHPackages © 2026

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