PHPackages                             gabrielchavezme/pdf-table-of-content - 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. gabrielchavezme/pdf-table-of-content

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

gabrielchavezme/pdf-table-of-content
====================================

1.0.5(4y ago)0191[1 issues](https://github.com/gabrielchavezme/pdf-table-of-content/issues)[1 PRs](https://github.com/gabrielchavezme/pdf-table-of-content/pulls)Apache-2.0PHPPHP &gt;=7.2

Since Jul 10Pushed 3y ago1 watchersCompare

[ Source](https://github.com/gabrielchavezme/pdf-table-of-content)[ Packagist](https://packagist.org/packages/gabrielchavezme/pdf-table-of-content)[ RSS](/packages/gabrielchavezme-pdf-table-of-content/feed)WikiDiscussions main Synced 3d ago

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

[![](https://camo.githubusercontent.com/db666af2077490e3cca1c1d2e4cab218916b07e92ab936580c4a7c7342736a45/68747470733a2f2f6761627269656c63686176657a2e6d652f73746f726167652f323032312f30312f4c6f676f7469706f2d4761627269656c2d43686125434325383176657a2d30332d31303234783234302e706e67)](https://gabrielchavez.me) Pdf Merge &amp; table of content Solution for PHP and Laravel
=============================================================

[](#pdf-merge--table-of-content-solution-for-php-and-laravel)

This package is a wrapper for the `TCPDF` class that provides an elegant API for merging PDF files and returns a table of contents with bookmarks.

This library is based on the source code of: [karriereat/pdf-merge](https://github.com/karriereat/pdf-merge)

The same code structure was used and the functionality was added to make a bookmark in each added document, later it returns an array with the document's table of contents in order to render it in a JS engine on the frontend side.

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

[](#installation)

You can install the package via composer:

```
composer require gabrielchavezme/pdf-table-of-content
```

Usage
-----

[](#usage)

```
$pdfMerge = new PdfTableOfContent();

$pdfMerge->add([
    'file' => '/path/to/file1.pdf',
    'title' => 'File 1',
    'id' => 1
]);
$pdfMerge->add([
    'file' => '/path/to/file2.pdf',
    'title' => 'File 2',
    'id' => 2
]);

$pdfMerge->merge('/path/to/output.pdf');
```

Please note, that the `merge` method will throw an `NoFilesDefinedException` if no files where added.

### Check for file existence

[](#check-for-file-existence)

You can check if a file was already added for merging by calling:

```
$pdfMerge->contains('/path/to/file.pdf');
```

License
-------

[](#license)

Apache License 2.0 Please see [LICENSE](LICENSE) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

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

Total

6

Last Release

1665d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/db3e78dbc76b37edda9896b132bb454f6e322c42043a7b07f23e668359e9ac9d?d=identicon)[gabrielchavezme](/maintainers/gabrielchavezme)

---

Top Contributors

[![gabrielchavezme](https://avatars.githubusercontent.com/u/28960114?v=4)](https://github.com/gabrielchavezme "gabrielchavezme (7 commits)")

---

Tags

phplaravelpdftable of content

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/gabrielchavezme-pdf-table-of-content/health.svg)

```
[![Health](https://phpackages.com/badges/gabrielchavezme-pdf-table-of-content/health.svg)](https://phpackages.com/packages/gabrielchavezme-pdf-table-of-content)
```

###  Alternatives

[elibyy/tcpdf-laravel

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

3542.7M5](/packages/elibyy-tcpdf-laravel)[mostafaznv/pdf-optimizer

PDF optimization tool for PHP and Laravel applications

170125.8k](/packages/mostafaznv-pdf-optimizer)[imal-h/pdf-box

The most advanced, driver-based PDF manipulation library for PHP v3.0. Supports Ghostscript, Chrome Headless (HTML to PDF), OpenSSL/FPDI (Signing), and PDFtk (Forms).

60403.9k](/packages/imal-h-pdf-box)[renatio/dynamicpdf-plugin

October HTML to PDF converter using dompdf library.

3113.4k3](/packages/renatio-dynamicpdf-plugin)[tarfin-labs/easy-pdf

Makes pdf processing easy.

1718.3k](/packages/tarfin-labs-easy-pdf)

PHPackages © 2026

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