PHPackages                             enlight/scratch - 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. enlight/scratch

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

enlight/scratch
===============

Markdown to PDF book builder

1.1(3y ago)07MITPHP

Since Mar 6Pushed 3y ago1 watchersCompare

[ Source](https://github.com/bhushan/scratch)[ Packagist](https://packagist.org/packages/enlight/scratch)[ Docs](https://github.com/bhushan/scratch)[ RSS](/packages/enlight-scratch/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (7)Versions (6)Used By (0)

---

THIS IS WELL MAINTAINED FORK OF THEMSAID/IBIS PROJECT.

---

This PHP tool helps you write eBooks in markdown. Run `scratch build` and an eBook will be generated with:

1. A cover photo.
2. Clickable auto-generated table of contents.
3. Code syntax highlighting.
4. Available in 2 themes. Light and dark.

Installation
------------

[](#installation)

Make sure you have PHP7.3 or above installed on your system and that your gd extension is enabled in your php.ini file.

First, install the composer package globally:

```
composer global require enlight/scratch

```

Then, run this command inside an empty directory:

```
scratch init

```

This will create the following files and directories:

- /assets
- /assets/fonts
- /assets/cover.jpg
- /assets/theme-light.html
- /assets/theme-dark.html
- /content
- /scratch.php

You may configure your book by editing the `/scratch.php` configuration file.

Writing Your eBook
------------------

[](#writing-your-ebook)

The `init` command will create sample .md files inside the content folder. You can explore those files to see how you can write your book. This sample content is taken from [Laravel Queues in Action](https://learn-laravel-queues.com).

Inside the content directory, you can write multiple `.md` files. Scratch uses the headings to divide the book into parts and chapters:

```
# Part 1

 tags define the start of a part. A separate PDF page will be generated to print the part title and any content below.

## Chapter 1

 tags define the start of a chapter. A chapter starts on a new page always.

### Starting with Scratch

 tags define different titles inside a chapter.

```

### Using images

[](#using-images)

Images can be stored in the content folder and then brought in like this:

```
![Screenshot 1](content/screenshot-1.png)

```

### Adding a cover image

[](#adding-a-cover-image)

To use a cover image, add a `cover.jpg` in the `assets/` directory (or a `cover.html` file if you'd prefer a HTML-based cover page). If you don't want a cover image, delete these files.

Using Fonts
-----------

[](#using-fonts)

Edit your `/scratch.php` configuration files to define the font files to be loaded from the `/assets/fonts` directory. After that you may use the defined fonts in your themes (`/assets/theme-light.html` &amp; `/assets/theme-dark.html`).

Generating PDF eBook
--------------------

[](#generating-pdf-ebook)

```
scratch build

```

Scratch will parse the files in alphabetical order and store the PDF file in `/export`.

The default is to generate the PDF using the light theme, to generate a PDF using the dark theme:

```
scratch build dark

```

Generating A Sample
-------------------

[](#generating-a-sample)

```
scratch sample

scratch sample dark

```

This command will use the generated files from the `scratch build` command to generate samples from your PDF eBook. You can configure which pages to include in the sample by updating the `/scratch.php` file.

Development
-----------

[](#development)

This project uses PHP CS Fixer with a code standard defined in `.php-cs-fixer.php`.

To review code out of style, you can run the fix command as a dry run. Run the composer script like this:

`composer run csfix-review`

To fix the source code, run the following composer script:

`composer run csfix`

Credits
-------

[](#credits)

- [Bhushan Gaikwad](https://github.com/bhushan)
- [Mohamed Said](https://github.com/themsaid)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 56.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 ~84 days

Total

5

Last Release

1245d ago

Major Versions

v0.0.3 → v1.0.02022-03-06

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/233003?v=4)[Vadim Macagon](/maintainers/enlight)[@enlight](https://github.com/enlight)

---

Top Contributors

[![themsaid](https://avatars.githubusercontent.com/u/4332182?v=4)](https://github.com/themsaid "themsaid (31 commits)")[![bhushan](https://avatars.githubusercontent.com/u/43483545?v=4)](https://github.com/bhushan "bhushan (4 commits)")[![aaronsaray](https://avatars.githubusercontent.com/u/956888?v=4)](https://github.com/aaronsaray "aaronsaray (4 commits)")[![tarekdj](https://avatars.githubusercontent.com/u/540268?v=4)](https://github.com/tarekdj "tarekdj (3 commits)")[![phikhi](https://avatars.githubusercontent.com/u/3796408?v=4)](https://github.com/phikhi "phikhi (3 commits)")[![liorchamla](https://avatars.githubusercontent.com/u/17835706?v=4)](https://github.com/liorchamla "liorchamla (1 commits)")[![owenvoke](https://avatars.githubusercontent.com/u/1899334?v=4)](https://github.com/owenvoke "owenvoke (1 commits)")[![shalvah](https://avatars.githubusercontent.com/u/14361073?v=4)](https://github.com/shalvah "shalvah (1 commits)")[![s-moon](https://avatars.githubusercontent.com/u/1986262?v=4)](https://github.com/s-moon "s-moon (1 commits)")[![aarondfrancis](https://avatars.githubusercontent.com/u/881931?v=4)](https://github.com/aarondfrancis "aarondfrancis (1 commits)")[![thinkverse](https://avatars.githubusercontent.com/u/2221746?v=4)](https://github.com/thinkverse "thinkverse (1 commits)")[![alexellis](https://avatars.githubusercontent.com/u/6358735?v=4)](https://github.com/alexellis "alexellis (1 commits)")[![dcblogdev](https://avatars.githubusercontent.com/u/1018170?v=4)](https://github.com/dcblogdev "dcblogdev (1 commits)")[![eberkund](https://avatars.githubusercontent.com/u/4555959?v=4)](https://github.com/eberkund "eberkund (1 commits)")[![jer3m01](https://avatars.githubusercontent.com/u/33844379?v=4)](https://github.com/jer3m01 "jer3m01 (1 commits)")

---

Tags

phppdfmarkdownbook

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/enlight-scratch/health.svg)

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

###  Alternatives

[themsaid/ibis

Markdown to PDF book builder

2.0k2.0k](/packages/themsaid-ibis)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M194](/packages/laravel-ai)[moonshine/moonshine

Laravel administration panel

1.3k253.1k81](/packages/moonshine-moonshine)[laravel/folio

Page based routing for Laravel.

603583.7k33](/packages/laravel-folio)[hi-folks/ibis-next

Creating EPUB and PDF ebook from Markdown

1191.1k](/packages/hi-folks-ibis-next)

PHPackages © 2026

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