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(4mo ago)21473.9k—7.1%220MITPHPPHP ^7.2 || ^8.0CI passing

Since Jun 4Pushed 4mo 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 1mo 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

55

—

FairBetter than 98% of packages

Maintenance77

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

124d ago

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

v0.2PHP ^7.2 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/f9ebdaae2204a36dda75aa9ef0573dbba2e06f912a04a088c0b703a16a307616?d=identicon)[Tomsgu](/maintainers/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.7k77.1M493](/packages/mpdf-mpdf)[webklex/laravel-pdfmerger

Generic PDF merger for Laravel

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

PHP PDF Merger

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

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

54097.2k](/packages/creagia-laravel-sign-pad)[setasign/fpdi-protection

A FPDI compatible version of the FPDF\_Protection script.

324.3M2](/packages/setasign-fpdi-protection)[binarystash/pdf-watermarker

Watermark or stamp PDF documents

8260.6k](/packages/binarystash-pdf-watermarker)

PHPackages © 2026

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