MIT selection E-invoicing

E-invoice XML validator

Slamdunk/php-validatore-fattura-elettronica

php-validatore-fattura-elettronica is a PHP library that checks that an Italian electronic invoice XML file complies with the XML structure and the XSD schemas from the Agenzia delle Entrate.

A translucent sheet laid on a grid, with green points of light where the lines align.
Author
Slamdunk
Language
PHP
Licence
MIT
GitHub stars
22
Last activity
Category
E-invoicing

Licence checked on 25/10/2026. Stars and last activity recorded on GitHub on the same date.

Overview

The library exposes a Validator class. Its assertValidXml method checks an electronic invoice XML: it throws one exception if the XML structure is wrong and another if the XML is valid but does not comply with the XSD. The getAllExceptions method instead returns the list of all errors found, empty if everything is correct.

It can also validate notification messages, using the XSD_MESSAGGI_LATEST constant. The XSDs come from the Agenzia delle Entrate website. The README warns that the package only works for Italian standards, and that email validation is deliberately more permissive: it is left to the user.

Highlights

  • assertValidXml distinguishes two errors: wrong XML structure (InvalidXmlStructureException) and XML not complying with the XSD (InvalidXsdStructureComplianceException).
  • getAllExceptions returns an array of all detected exceptions, empty if the document is valid.
  • Notification validation is possible with Validator::XSD_MESSAGGI_LATEST.
  • XSDs taken from the Agenzia delle Entrate website, judged more up to date than the other reference site cited (fatturapa.gov.it).
  • The XSD’s email regular expression is replaced by a more permissive one, with the diff documented in the README.

Who it is for

For PHP developers who produce or receive Italian electronic invoices in XML and want to check them before sending or processing.

Installation

Install with Composer, then instantiate the Validator class and call assertValidXml or getAllExceptions with the XML content.

Commands

Read the project README before running these commands.

composer require slam/php-validatore-fattura-elettronica

Read the README on GitHub

Points of attention

  • The README warns that the package only works for Italian standards.
  • Email validation is deliberately permissive and left to the user: the original XSD was modified on this point.
  • The repository’s composer.json requires PHP ~8.4 or ~8.5 with the dom and libxml extensions; the README does not say so.

Can an agent use it?

No SKILL.md, AGENTS.md, CLAUDE.md, Cursor rules or MCP server found at the root or in the README. This is a PHP library to call from code.

Likes and comments

No account needed: one like per browser, which you can remove. Comments are published after review.

This project is hosted by its author: your comments are about this page, not the code. To report an issue with the project, use its repository.

MIT selection

Italian e-invoices in PHP

fatturaelettronicaphp/FatturaElettronica

Reads, generates and validates Italian electronic invoices, in PHP.

MIT selection

IBAN in Python

mdomke/schwifty

Parses and validates IBAN numbers, in Python.

Made by SOGNI DIGITALI

Complete design system

design-system-builder

One interactive multilingual page plus the design.md file your coding agents read.

A custom skill for your trade?

We also write private skills, in your name. Let's talk about it on a 30-minute call.

Book the free call (30 min)