PHPackages                             fawno/fpdf-traits - 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. fawno/fpdf-traits

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

fawno/fpdf-traits
=================

A modular plugin system for FPDF based on PHP Traits.

1.0.2(1mo ago)04MITPHPPHP &gt;=7.2

Since Jun 30Pushed 1mo agoCompare

[ Source](https://github.com/fawno/FPDF-Traits)[ Packagist](https://packagist.org/packages/fawno/fpdf-traits)[ Docs](https://github.com/fawno/FPDF-Scripts)[ RSS](/packages/fawno-fpdf-traits/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (4)Versions (4)Used By (0)

[![GitHub Workflow](https://github.com/fawno/FPDF-Traits/actions/workflows/php.yml/badge.svg)](https://github.com/fawno/FPDF-Traits/actions/workflows/php.yml)[![GitHub license](https://camo.githubusercontent.com/48386bc78ea531837ff4900280f85baa425ada2cb1d1683fac5d96e53378b868/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6661776e6f2f465044462d547261697473)](https://github.com/fawno/FPDF-Traits/blob/master/LICENSE)[![GitHub tag (latest SemVer)](https://camo.githubusercontent.com/f18fe8518bf7ca682d8c19902927825322cbb696c3354a07f1cb312042d8fe7b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f6661776e6f2f465044462d547261697473)](https://github.com/fawno/FPDF-Traits/tags)[![Packagist](https://camo.githubusercontent.com/3bea2fb7e2811c5e0b2d16df6544c1aeaad441e70f1ba95ca2e064aa84969d77/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6661776e6f2f667064662d747261697473)](https://packagist.org/packages/fawno/fpdf-traits)[![Packagist Downloads](https://camo.githubusercontent.com/920ff88501d699a67af630835dbb69d98322df9e0abc3c9b4fee499c725c1876/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6661776e6f2f667064662d747261697473)](https://packagist.org/packages/fawno/fpdf-traits/stats)[![GitHub issues](https://camo.githubusercontent.com/d7253c17dc6d59bf6b3c8acaaf34579bf039d3c060fb0763210a5103886f7ba2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6661776e6f2f465044462d547261697473)](https://github.com/fawno/FPDF-Traits/issues)[![GitHub forks](https://camo.githubusercontent.com/3aa79ef48f00a7cb0e99fcb117cdab7f71518cbbb341556455b4c275988014a4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6661776e6f2f465044462d547261697473)](https://github.com/fawno/FPDF-Traits/network)[![GitHub stars](https://camo.githubusercontent.com/21e034e3f42659887d8220422179b3effdd82866ca0c71e40699e1cad3e434ad/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6661776e6f2f465044462d547261697473)](https://github.com/fawno/FPDF-Traits/stargazers)

FPDF Traits
===========

[](#fpdf-traits)

A modular plugin system for **[FPDF](https://www.fpdf.org/)** based on PHP Traits.

What is this?
-------------

[](#what-is-this)

**FPDF Traits** is a collection of community FPDF scripts converted into reusable PHP Traits.

The original FPDF ecosystem provides many useful scripts (rotations, barcodes, tables, bookmarks, watermarks, etc.), but most of them rely on class inheritance, making it difficult to combine multiple scripts in the same PDF class.

This project solves that limitation by transforming those scripts into composable Traits.

Instead of:

```
class PDF extends PDF_Rotate
{
}
```

you can now do:

```
class PDF extends FPDF
{
    use RotateTrait;
    use BookmarkTrait;
    use Code128Trait;
}
```

This allows developers to build custom PDF engines by composing only the features they need.

Why?
----

[](#why)

Traditional FPDF extensions have several limitations:

- Single inheritance restrictions
- Difficult script composition
- Tight coupling between scripts
- Repeated code between extensions
- Harder maintenance

Using Traits provides:

- Modular architecture
- Better code reuse
- Easier maintenance
- Multiple feature composition
- Cleaner integration
- Better compatibility with modern PHP projects

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

[](#installation)

Install via Composer:

```
composer require fawno/fpdf-traits
```

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

[](#requirements)

- PHP 8.1 or higher
- FPDF 1.8+

Basic usage
-----------

[](#basic-usage)

```
use Fawno\FPDF\FawnoFPDF;

$pdf = new FawnoFPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();
```

Alternative usage
-----------------

[](#alternative-usage)

```
use FPDF\Traits\Attachments\AttachmentsTrait;

class PDF extends FPDF {
    use AttachmentsTrait;
}
```

Available Traits
----------------

[](#available-traits)

[Available traits](traits).

### Graphics

[](#graphics)

- [PDFRotate](traits/PDFRotate) by **Olivier** (2002-11-17)
- [PDFTransform](traits/PDFTransform) by **Moritz Wagner &amp; Andreas Würmser** (2005-09-04)
- [PDFDraw](traits/PDFDraw) by **David Hernández Sanz** (2005-01-16)

### Text

[](#text)

- [PDFBookmark](traits/PDFBookmark) by **Olivier** (2002-11-17)
- [PDFMultiCellsTable](traits/PDFMultiCellsTable) by **Olivier** (2002-11-17)
- [PDFCircularText](traits/PDFCircularText) by **Andreas Würmserr** (2006-04-09)
- [RPDF](traits/RPDF) by **Pivkin Vladimir** (2003-08-28)

### Barcodes

[](#barcodes)

- [PDFCode128](traits/PDFCode128) by **Roland Gautier** (2016-01-31)
- [QRcode](traits/QRcode) by **Laurent MINGUET** (2010-04-29)

### Others

[](#others)

- [PDFProtection](traits/PDFProtection) by **Klemen Vodopivec** (2018-03-19)
- [PDFMemImage](traits/PDFMemImage) by **Olivier** (2004-04-05)
- [Attachments](traits/Attachments) by **Olivier** (2012-04-29)
- [ESignaturePlaceholder](traits/ESignaturePlaceholder) by **Erik N.** (2025-12-06)

Compatibility
-------------

[](#compatibility)

Each Trait is a direct adaptation of an original FPDF script whenever possible.

The goal is to preserve compatibility with original examples and documentation.

This project is designed to work directly with the official FPDF class.

Some Traits may depend on internal FPDF methods like:

- `_out()`
- `_newobj()`
- `_putstream()`

Because of this, compatibility may be tied to specific FPDF versions.

Please check each Trait documentation.

Philosophy
----------

[](#philosophy)

This project follows these principles:

- Keep original script behavior
- Minimal API changes
- Maximum composability
- Modern PHP standards
- Clean namespaces
- PSR-4 autoloading

Contributing
------------

[](#contributing)

Contributions are welcome.

You can help by:

- Porting new FPDF scripts into Traits
- Improving compatibility
- Writing tests
- Improving documentation
- Reporting issues

Credits
-------

[](#credits)

- Original [FPDF](https://www.fpdf.org/) library by Olivier Plathey
- Original community scripts from the [FPDF Script Repository](https://www.fpdf.org/en/script/index.php)
- All contributors to the FPDF ecosystem

###  Health Score

34

—

LowBetter than 74% of packages

Maintenance90

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

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

Total

3

Last Release

45d ago

### Community

Maintainers

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

---

Top Contributors

[![alphp](https://avatars.githubusercontent.com/u/8992091?v=4)](https://github.com/alphp "alphp (3 commits)")

---

Tags

pdffpdf

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fawno-fpdf-traits/health.svg)

```
[![Health](https://phpackages.com/badges/fawno-fpdf-traits/health.svg)](https://phpackages.com/packages/fawno-fpdf-traits)
```

###  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.2k160.9M314](/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.

77873.5M300](/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.

438.1M47](/packages/setasign-tfpdf)[tmw/fpdm

PDF form filling using FPDM Class written by FPDF author Olivier

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

FPDF Composer Wrapper

513.2M31](/packages/fpdf-fpdf)[setasign/fpdi-protection

A FPDI compatible version of the FPDF\_Protection script.

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

PHPackages © 2026

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