PHPackages                             laurentmuller/fpdf2 - 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. laurentmuller/fpdf2

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

laurentmuller/fpdf2
===================

FPDF 2 is a PHP class which allows to generate PDF files with pure PHP. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.

4.3.2(2mo ago)68.3k↓45.8%3MITPHPPHP ^8.3CI passing

Since Feb 4Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/laurentmuller/fpdf2)[ Packagist](https://packagist.org/packages/laurentmuller/fpdf2)[ Docs](https://github.com/laurentmuller/fpdf2)[ RSS](/packages/laurentmuller-fpdf2/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (79)Used By (0)

FPDF2
=====

[](#fpdf2)

This repository is a clone of [fpdf.org](http://www.fpdf.org) with typed variables, enumerations and PHP 8.3 dependencies.

`PdfDocument` is a PHP class, which allows generating PDF files with pure PHP. **F** from FPDF2 stands for **Free**: you may use it for any kind of usage and modify it to suit your needs.

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

[](#installation)

If you're using [Composer](https://getcomposer.org/) to manage dependencies, you can use:

```
composer require laurentmuller/fpdf2
```

Alternatively, you can add the requirement `"laurentmuller/fpdf2":"^4.0"` to your `composer.json` file and run `composer update`. This could be useful when the installation of FPDF2 is not compatible with some installed dependencies. Anyway, the previous option is the preferred way, since the composer can pick the best requirement constraint for you.

Requirements
------------

[](#requirements)

BranchPHP Versionmaster8.33.x8.2Basic Usage
-----------

[](#basic-usage)

```
use fpdf\Enums\PdfFontName;
use fpdf\Enums\PdfFontStyle;
use fpdf\PdfDocument;

$pdf = new PdfDocument();
$pdf->addPage();
$pdf->setFont(PdfFontName::ARIAL, PdfFontStyle::BOLD, 16);
$pdf->cell(40, 10, 'Hello World!');
$pdf->output();
```

See other [examples](doc/examples.md) in the dedicated documents.

Code Quality
------------

[](#code-quality)

[![SymfonyInsight](https://camo.githubusercontent.com/c0cc69d3c85415d9ea5c00bc5a3e8d3edb3d3ef8868a155c42d07771935df83f/68747470733a2f2f696e73696768742e73796d666f6e792e636f6d2f70726f6a656374732f31646234663238632d633037632d346135662d383030362d3263363365623165383835312f6d696e692e737667)](https://insight.symfony.com/projects/1db4f28c-c07c-4a5f-8006-2c63eb1e8851)[![Codacy](https://camo.githubusercontent.com/a1a17a78390ce0d5f712043c8c52697703e8ec9f904caaad64adc8c642c463e5/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6137306336383466323163343436666238383635386163663239666461666435)](https://app.codacy.com/gh/laurentmuller/fpdf2/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)[![PHP-Stan](https://camo.githubusercontent.com/daf74d517e9a2379b58014fee6bd7156bed21c42e2a40186a5b404f4b64f5c98/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c25323031302d627269676874677265656e2e7376673f7374796c653d666c6174266c6f676f3d706870)](https://phpstan.org/blog/find-bugs-in-your-code-without-writing-tests)[![CodeFactor](https://camo.githubusercontent.com/feaf56b3a1f65dc81f3c261046480bc7acb1837da4ed0abee394e9994fdffa3a/68747470733a2f2f7777772e636f6465666163746f722e696f2f7265706f7369746f72792f6769746875622f6c617572656e746d756c6c65722f66706466322f6261646765)](https://www.codefactor.io/repository/github/laurentmuller/fpdf2)[![Codecov](https://camo.githubusercontent.com/adddc8e059c9ccc91196154dd38007af1dd0cfc6684b62d687f199c1949489b1/68747470733a2f2f636f6465636f762e696f2f67682f6c617572656e746d756c6c65722f66706466322f67726170682f62616467652e7376673f746f6b656e3d313649384c4359525253)](https://codecov.io/gh/laurentmuller/fpdf2)

Actions
-------

[](#actions)

[![PHP-CS-Fixer](https://github.com/laurentmuller/fpdf2/actions/workflows/php-cs-fixer.yaml/badge.svg)](https://github.com/laurentmuller/fpdf2/actions/workflows/php-cs-fixer.yaml)[![PHPStan](https://github.com/laurentmuller/fpdf2/actions/workflows/php_stan.yaml/badge.svg)](https://github.com/laurentmuller/fpdf2/actions/workflows/php_stan.yaml)[![PHPUnit](https://github.com/laurentmuller/fpdf2/actions/workflows/php_unit.yaml/badge.svg)](https://github.com/laurentmuller/fpdf2/actions/workflows/php_unit.yaml)[![Rector](https://github.com/laurentmuller/fpdf2/actions/workflows/rector.yaml/badge.svg)](https://github.com/laurentmuller/fpdf2/actions/workflows/rector.yaml)[![Lint](https://github.com/laurentmuller/fpdf2/actions/workflows/lint.yaml/badge.svg)](https://github.com/laurentmuller/fpdf2/actions/workflows/lint.yaml)[![StyleCI](https://camo.githubusercontent.com/98e2dad3e1725038ee0b8aeb7ea027c189e0ec25835f25165c0c570ac42d717e/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3735323637363038312f736869656c643f6272616e63683d6d61696e)](https://github.styleci.io/repos/752676081?branch=main)

###  Health Score

55

—

FairBetter than 98% of packages

Maintenance89

Actively maintained with recent releases

Popularity31

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 96.8% 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 ~10 days

Recently: every ~2 days

Total

78

Last Release

60d ago

Major Versions

1.9.0.9 → 2.0.0.02024-08-08

2.0.14 → 3.0.02025-01-30

3.2.3 → 4.0.02026-02-08

PHP version history (3 changes)1.8.4-alphaPHP ^8.1

1.8.4-alpha-3PHP ^8.2

4.0.0PHP ^8.3

### Community

Maintainers

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

---

Top Contributors

[![laurentmuller](https://avatars.githubusercontent.com/u/4330059?v=4)](https://github.com/laurentmuller "laurentmuller (361 commits)")[![devmount](https://avatars.githubusercontent.com/u/5441654?v=4)](https://github.com/devmount "devmount (12 commits)")

---

Tags

fpdfpdfpdffpdf

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/laurentmuller-fpdf2/health.svg)

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

###  Alternatives

[setasign/fpdi

FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.

1.2k142.4M231](/packages/setasign-fpdi)[setasign/fpdf

FPDF is a PHP class which allows to generate PDF files with pure PHP. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.

76863.8M227](/packages/setasign-fpdf)[setasign/tfpdf

This class is a modified version of FPDF that adds UTF-8 support. The latest version is based on FPDF 1.85.

426.1M30](/packages/setasign-tfpdf)[tmw/fpdm

PDF form filling using FPDM Class written by FPDF author Olivier

129623.6k3](/packages/tmw-fpdm)[fpdf/fpdf

FPDF Composer Wrapper

512.7M22](/packages/fpdf-fpdf)[setasign/fpdi-protection

A FPDI compatible version of the FPDF\_Protection script.

324.3M2](/packages/setasign-fpdi-protection)

PHPackages © 2026

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