PHPackages                             tomsgu/pdf-merger - 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. tomsgu/pdf-merger

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

tomsgu/pdf-merger
=================

v0.5.1(5mo ago)21516.8k↓57.3%220MITPHPPHP ^7.2 || ^8.0CI failing

Since Jun 4Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/Tomsgu/PDFMerger)[ Packagist](https://packagist.org/packages/tomsgu/pdf-merger)[ RSS](/packages/tomsgu-pdf-merger/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (7)Dependencies (4)Versions (9)Used By (20)

PDFMerger
=========

[](#pdfmerger)

Simple wrapper for merging pdfs for PHP &gt;= 7.2 based on setasign/fpdi and fpdf libraries, inspired by clegginabox/pdf-merger.

When using a symfony framework you can use [tomsgu/pdf-merger-bundle](https://github.com/Tomsgu/PDFMergerBundle) bundle.

Installation
============

[](#installation)

```
composer require tomsgu/pdf-merger
```

Usage
=====

[](#usage)

```
$pdfCollection = new PdfCollection();
$pdfCollection->addPdf('filename.pdf', PdfFile::ALL_PAGES, PdfFile::ORIENTATION_PORTRAIT);
$pdfCollection->addPdf('filename2.pdf', '1-4,9', PdfFile::ORIENTATION_LANDSCAPE);
$pdfCollection->addPdf('filename3.pdf', '1-4,9', PdfFile::ORIENTATION_AUTO_DETECT);
$pdfCollection->addPdf('filename4.pdf');

// You can also pass a resource
$resource = fopen('filename4.pdf', 'r');
$pdfCollection->addPdf($resource);

$fpdi = new Fpdi();
$merger = new PdfMerger($fpdi);
/**
 * Available modes: MODE_FILE, MODE_DOWNLOAD, MODE_STRING, MODE_BROWSER
 * Orientation: This is a fallback if the orientation wasn't specified when adding pdf.
 */
$merger->merge($pdfCollection, 'output.pdf', PdfMerger::MODE_FILE, PdfFile::ORIENTATION_LANDSCAPE);
```

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance70

Regular maintenance activity

Popularity45

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 97.1% 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 ~463 days

Recently: every ~446 days

Total

7

Last Release

171d ago

PHP version history (2 changes)v0.1PHP ^7.2

v0.2PHP ^7.2 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2694769?v=4)[Tomsgu](/maintainers/Tomsgu)[@Tomsgu](https://github.com/Tomsgu)

---

Top Contributors

[![Tomsgu](https://avatars.githubusercontent.com/u/2694769?v=4)](https://github.com/Tomsgu "Tomsgu (34 commits)")[![Altherius](https://avatars.githubusercontent.com/u/6648753?v=4)](https://github.com/Altherius "Altherius (1 commits)")

---

Tags

pdf merge

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tomsgu-pdf-merger/health.svg)

```
[![Health](https://phpackages.com/badges/tomsgu-pdf-merger/health.svg)](https://phpackages.com/packages/tomsgu-pdf-merger)
```

###  Alternatives

[mpdf/mpdf

PHP library generating PDF files from UTF-8 encoded HTML

4.7k83.4M565](/packages/mpdf-mpdf)[horstoeko/zugferd

A library for creating and reading european electronic invoices

4295.8M30](/packages/horstoeko-zugferd)[atgp/factur-x

PHP library to manage your Factur-X / ZUGFeRD 2.0 PDF invoices files

153915.3k4](/packages/atgp-factur-x)[webklex/laravel-pdfmerger

Generic PDF merger for Laravel

1433.1M2](/packages/webklex-laravel-pdfmerger)[jurosh/pdf-merge

PHP PDF Merger

1552.4M5](/packages/jurosh-pdf-merge)[creagia/laravel-sign-pad

Laravel package for of E-Signature with Signature Pad and Digital Certified Sign with TCPDF

546126.7k](/packages/creagia-laravel-sign-pad)

PHPackages © 2026

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