PHPackages                             robertogallea/php-fatturapa - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. robertogallea/php-fatturapa

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

robertogallea/php-fatturapa
===========================

Php package for Fattura Elettronica PA

0.2.7(1y ago)21.0k3PHPCI failing

Since Mar 19Pushed 1y ago2 watchersCompare

[ Source](https://github.com/robertogallea/php-fatturapa)[ Packagist](https://packagist.org/packages/robertogallea/php-fatturapa)[ RSS](/packages/robertogallea-php-fatturapa/feed)WikiDiscussions master Synced 1w ago

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

php-fatturapa
=============

[](#php-fatturapa)

php-fatturapa is a php implementation for FatturaPA XML specification. It allows reading from and writing to files formatted as described in [the current specifications](https://www.agenziaentrate.gov.it/wps/file/Nsilib/Nsi/Schede/Comunicazioni/Fatture+e+corrispettivi/Fatture+e+corrispettivi+ST/ST+invio+di+fatturazione+elettronica/ST+Fatturazione+elettronica+-+Allegato+A/Allegato+A+-+Specifiche+tecniche+vers+1.4.pdf)

1. Installation
---------------

[](#1-installation)

To install php-fatturapa, require it using composer:

```
composer require robertogallea/php-fatturapa

```

2. Usage
--------

[](#2-usage)

php-fatturapa currently supports only the Fattura Ordinaria model (not Fattura Semplificata)

The whole DOM of the XML document is wrapped by the class FatturaOrdinaria, which could be used directly or build using FatturaPA class.

Follow some basic usage exmaples:

### 2.1 Read From XML document file

[](#21-read-from-xml-document-file)

```
/*
 * Read from XML
 */
 $filename = 'IT01234567890_FPA01.xml';
 $fattura = FatturaPA::readFromXML($filename);
```

### 2.2 Read From signed XML file

[](#22-read-from-signed-xml-file)

```
/*
 * Read from XML signed document
 */
 $filename = 'IT01879020517_e4duu.xml.p7m';
 $fattura = FatturaPA::readFromSignedXML($filename);
```

### 2.3 Read From XML string

[](#23-read-from-xml-string)

```
/*
 * Read from XML string
 */
 $xml = '';
 $fattura = FatturaPA::readFromXMLString($xml);
```

### 2.4 Write to XML file

[](#24-write-to-xml-file)

```
/*
 * Read from XML
 */
 $filename = 'IT01234567890_FPA01.xml';
 FatturaPA::writeToXML($fattura, $filename);
```

### 2.5 Write to XML string

[](#25-write-to-xml-string)

```
/*
 * Write to XML string
 */
 $xml = FatturaPA::writeToXMLString($fattura);
```

3. Attachment handling
----------------------

[](#3-attachment-handling)

php-fatturapa provides methods for easily add and extract attachments to and from the XML document.
By specifications they are stored inside the FatturaElettronicaBody element, so the`FatturaElettronicaBody` class provides convenient methods for storing attachments performing the required compresson and base64 encoding:

```
/*
 * Export attachments to folder
 */
 $filename = 'IT01234567890_FPA01.xml';
 $fattura = FatturaPA::readFromXML($filename);
 $folder = '/your/path';

 foreach ($fattura->getFatturaElettronicaBody() as $body);
   $body->esportaAllegati($folder);
 }
```

```
/*
 * Add attachment
 */
 $filename = 'IT01234567890_FPA01.xml';
 $fattura = FatturaPA::readFromXML($filename);
 $attachment_filename = /path/to.pdf;
 $attachment = Allegati::createFromFile($attachment_filename,'Name','Description');
 $fattura->getFatturaElettronicaBody()[0]->addAttachment($attachment);

```

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance43

Moderate activity, may be stable

Popularity24

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~1 days

Total

9

Last Release

455d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/818f547bcf73a82393d9014c85c90c83d760102a8d4dfe806353afb83848a901?d=identicon)[robertogallea](/maintainers/robertogallea)

---

Top Contributors

[![robertogallea](https://avatars.githubusercontent.com/u/19411470?v=4)](https://github.com/robertogallea "robertogallea (9 commits)")[![xBorgo](https://avatars.githubusercontent.com/u/83426549?v=4)](https://github.com/xBorgo "xBorgo (7 commits)")[![gecche](https://avatars.githubusercontent.com/u/11093763?v=4)](https://github.com/gecche "gecche (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

### Embed Badge

![Health badge](/badges/robertogallea-php-fatturapa/health.svg)

```
[![Health](https://phpackages.com/badges/robertogallea-php-fatturapa/health.svg)](https://phpackages.com/packages/robertogallea-php-fatturapa)
```

###  Alternatives

[litesaml/lightsaml

SAML 2.0 PHP library

1076.6M27](/packages/litesaml-lightsaml)[greenter/greenter

Facturacion Electrónica SUNAT en Perú

34739.9k1](/packages/greenter-greenter)[salla/zatca

A helper to generate the QR code and signed it for ZATCA e-invoicing

165463.2k2](/packages/salla-zatca)[egroupware/egroupware

EGroupware extends a classic groupware with an integrated CRM-system, a secure file-server and Collabora Online Office.

2951.7k](/packages/egroupware-egroupware)[fresns/fresns

Cross-platform general-purpose multiple content forms social network service software.

4881.5k](/packages/fresns-fresns)[karsonzhang/fastadmin-addons

addons package for fastadmin

29189.7k](/packages/karsonzhang-fastadmin-addons)

PHPackages © 2026

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