typesetterio / typesetter-cli
Create PDFs from markdown with PHP.
Package info
github.com/TypesetterIO/typesetter-cli
Type:project
pkg:composer/typesetterio/typesetter-cli
Requires
- php: ^8.4
- laravel-zero/foundation: ^13.23.1
- laravel-zero/framework: ^13.0
- typesetterio/typesetter: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.95
- larastan/larastan: ^3.13
- mockery/mockery: ^1.6.12
- phpunit/phpunit: ^13.2
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Typesetter
Create ebooks, flyers, one-sheets and more from markdown! This command runs locally using PHP to convert your markdown into a PDF.
Install
This requires PHP 8.4 or above.
This tool is meant to be part of the repository that you have your written content. Because of that, you can install it into the local directory with the following command.
composer require typesetterio/typesetter-cli
Usage
Start a new project in the current directory:
vendor/bin/typesetter init
This writes config.php, a two chapter starter book in content/ and my-theme/theme.html.
Generate the PDF:
vendor/bin/typesetter generate
| Option | Default | |
|---|---|---|
--config |
config.php |
The config file. |
--output |
Slug of the title plus .pdf |
The PDF file to write. |
Both paths are relative to the working directory.
Docker
docker run --rm -v "$PWD":/runtime ghcr.io/typesetterio/typesetter-cli generate
The container runs as uid 1000. On Linux, to use a different user: --user "$(id -u):$(id -g)".
To learn more, please check out the documentation. This details configuration, customization, themes and cover generation, observers, listeners and more.
Development
Requires PHP 8.4 or newer, Composer, and hadolint. make act additionally needs Docker and act. On macOS, brew install php composer hadolint act.
Run make to list the available targets.
docker build -t typesetter-cli . builds the Docker image.
Changelog
See CHANGELOG.md.
Credits
This was heavily influenced by the Ibis project but is a complete rewrite.
This package stands on the shoulders of giants like MPDF, some parts of Laravel and also the League Commonmark library.
Aaron Saray is the primary author and maintainer.

