PHPackages                             aalonzolu/digifact - 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. [API Development](/categories/api)
4. /
5. aalonzolu/digifact

ActiveLibrary[API Development](/categories/api)

aalonzolu/digifact
==================

PHP SDK for Digifact FEL Guatemala e-invoicing API (v2)

v2.3.0(4w ago)1351[2 issues](https://github.com/aalonzolu/digifact/issues)MITPythonPHP &gt;=8.1CI passing

Since Nov 19Pushed 4w ago2 watchersCompare

[ Source](https://github.com/aalonzolu/digifact)[ Packagist](https://packagist.org/packages/aalonzolu/digifact)[ RSS](/packages/aalonzolu-digifact/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (3)Versions (16)Used By (0)

Digifact FEL SDK
================

[](#digifact-fel-sdk)

SDKs para la API Digifact FEL NUC GT — facturación electrónica SAT Guatemala.

SDKPaqueteVersión mínima[Python](./python/)[`digifact-sdk`](https://pypi.org/p/digifact-sdk) (PyPI)Python 3.10+[JavaScript](./javascript/)[`digifact-sdk`](https://www.npmjs.com/package/digifact-sdk) (npm)Node 18+[PHP](./php/)[`aalonzolu/digifact`](https://packagist.org/packages/aalonzolu/digifact) (Packagist)PHP 8.1+[C# / .NET](./dotnet/)[`Digifact.Fel`](https://www.nuget.org/packages/Digifact.Fel) (NuGet).NET 8+Instalación rápida
------------------

[](#instalación-rápida)

```
# Python
pip install digifact-sdk

# JavaScript
npm install digifact-sdk

# PHP
composer require aalonzolu/digifact

# C# / .NET
dotnet add package Digifact.Fel
```

Uso básico (los 4 SDKs)
-----------------------

[](#uso-básico-los-4-sdks)

```
# Python
from digifact_sdk import DigifactClient

client = DigifactClient(
    taxid="12345678",
    username="FELUSER",
    password="...",
    environment="test",   # o "production"
)
result = client.invoice("CF", [
    {"description": "Servicio", "qty": 1, "price": 100},
])
print(result.auth_number)
```

```
// JavaScript
import { DigifactClient } from 'digifact-sdk';

const client = new DigifactClient({
  taxid: '12345678', username: 'FELUSER', password: '...', environment: 'test',
});
const result = await client.invoice('CF', [
  { description: 'Servicio', qty: 1, price: 100 },
]);
console.log(result.authNumber);
```

```
// PHP
use Digifact\Fel\DigifactClient;

$client = new DigifactClient([
  'taxid' => '12345678', 'username' => 'FELUSER',
  'password' => '...', 'environment' => 'test',
]);
$result = $client->invoice('CF', [
  ['description' => 'Servicio', 'qty' => 1, 'price' => 100],
]);
echo $result->authNumber;
```

```
// C# / .NET
using Digifact.Fel;

using var client = new DigifactClient(new DigifactOptions {
  Taxid = "12345678", Username = "FELUSER",
  Password = "...", Environment = "test",
});
var result = await client.InvoiceAsync("CF", new[] {
  new LineItem { Description = "Servicio", Qty = 1, Price = 100 },
});
Console.WriteLine(result.AuthNumber);
```

Tipos de DTE soportados
-----------------------

[](#tipos-de-dte-soportados)

MétodoDTEDescripción`invoice()`FACTFactura de consumidor final o NIT`invoice()`FCAMFactura cambiaria con cuotas`invoice()`NABNNota de abono`invoice()`FESPFactura especial (retención)`invoice()`RDONRecibo por donación`invoice()`RECIRecibo de colegiatura`invoice()`FPEQFactura pequeño contribuyente`debitNote()`NDEBNota de débito`creditNote()`NCRENota de crédito parcial`creditNoteTotal()`—Nota de crédito total (anulación)`cancel()`—Anulación de DTE`fuelInvoice()`FACT+CombustibleFactura con IVA + impuesto PETROLEO`ccaInvoice()`FACT+CCACobro por cuenta ajena`lookupNit()`—Consulta nombre/dirección de un NIT en SAT`getDte()`—Descarga un DTE ya emitidoConfiguración del cliente (común a los 4 SDKs)
----------------------------------------------

[](#configuración-del-cliente-común-a-los-4-sdks)

Ordenados de más usados a menos usados.

ParámetroRequeridoDescripción`taxid` / `Taxid`✔NIT del emisor.`username` / `Username`✔Usuario Digifact (la parte después de `GT..`).`password` / `Password`✔\*Contraseña. \*O bien `token`.`token` / `Token`✔\*Bearer token preobtenido. \*O bien `password`.`environment` / `Environment``"test"` (default) o `"production"`.`seller_name` / `SellerName`Nombre del emisor. Para NIT individual es el nombre de la persona; para S.A. / S.E. es la razón social. Auto-consulta en SAT si se omite.`seller_address` / `SellerAddress`Dirección del emisor. Auto-consulta en SAT si se omite.`branch_code` / `BranchCode`Código del establecimiento (RTU). Default `"1"`.`branch_name` / `BranchName`Nombre comercial de la sucursal, el mismo que aparece en la patente de comercio. Default `"ESTABLECIMIENTO PRINCIPAL"`.`afiliacion_iva` / `AfiliacionIva``"GEN"` (default), `"PEQ"` o `"EXE"`.`tipo_frase` / `TipoFrase`Override global de `TipoFrase` (legacy). **Mutuamente exclusivo con `frases`**.`escenario` / `Escenario`Override global de `CodigoEscenario` (legacy). **Mutuamente exclusivo con `frases`**.`frases` / `Frases`**Nuevo.** Lista de frases `{tipo_frase, escenario}`. Reemplaza a `tipo_frase`/`escenario`. Mutuamente exclusivo con ellos.`auto_fuel_subsidy_frases` / `AutoFuelSubsidyFrases`**Nuevo.** Controla la auto-inyección de frases 9/18 y 9/19 en `fuelInvoice()`. Default `true` (o `null`).`petroleo_rates` / `PetroleoRates`Mapa código→tarifa PETROLEO para `fuelInvoice()` (sólo gasolineras).`timeout` / `Timeout`Timeout HTTP. Default 120s (JS: 120000 ms).`tipo_personeria` / `TipoPersoneria`Código de personería del RTU. Sólo aplica a RDON. Default `"1"`.Ver detalles y ejemplos por lenguaje en los READMEs respectivos.

Subsidio combustibles — frases automáticas (9/18 y 9/19)
--------------------------------------------------------

[](#subsidio-combustibles--frases-automáticas-918-y-919)

Durante el **periodo de subsidio** (2026-04-27 (incl.) a 2026-07-27 (excl.)), SAT exige incluir frases especiales `TipoFrase=9, Escenario=18` y `TipoFrase=9, Escenario=19` en facturas de combustible. **El SDK las agrega automáticamente** — las integraciones existentes no necesitan cambios.

Para deshabilitar la auto-inyección (ej. presupuesto agotado):

- Por ENV VAR (sin deploy): `DIGIFACT_DISABLE_AUTO_FUEL_SUBSIDY_FRASES=1`
- Por código: `auto_fuel_subsidy_frases=false` al inicializar el cliente o en cada llamada.

Para control total (frases propias): usa `frases=[...]` en lugar de `tipo_frase`/`escenario`.

Variables de entorno
--------------------

[](#variables-de-entorno)

```
DIGIFACT_TAXID=12345678
DIGIFACT_USERNAME=FELUSER
DIGIFACT_PASSWORD=...
# Deshabilita auto-inyección de frases de subsidio sin tocar código:
# DIGIFACT_DISABLE_AUTO_FUEL_SUBSIDY_FRASES=1
```

Estructura del repositorio
--------------------------

[](#estructura-del-repositorio)

```
digifact-sdk/
├── python/          SDK Python — pyproject.toml, digifact_sdk/
├── javascript/      SDK JavaScript — package.json, src/
├── php/             SDK PHP — composer.json, src/
├── dotnet/          SDK C#/.NET — Digifact.Fel.csproj, *.cs
├── docs/            Documentación y colección Postman
│   └── postman/     Colección y ambiente para Postman
├── scripts/         Herramientas de validación y smoke tests
└── .github/
    └── workflows/
        ├── ci.yml       Tests en cada push/PR
        └── publish.yml  Publicación a PyPI/npm/Packagist/NuGet al hacer tag

```

Publicar una release
--------------------

[](#publicar-una-release)

```
# Actualizar versiones en pyproject.toml y package.json, luego:
git tag v1.2.3
git push origin v1.2.3
```

El workflow `publish.yml` se activa automáticamente y publica los cuatro paquetes.

Documentación adicional
-----------------------

[](#documentación-adicional)

- [Python SDK](./python/README.md)
- [JavaScript SDK](./javascript/README.md)
- [PHP SDK](./php/README.md)
- [C# / .NET SDK](./dotnet/README.md)
- [Documentación SAT](./docs/documentacion_sat.md)
- [Colección Postman](./docs/postman/)

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance74

Regular maintenance activity

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity71

Established project with proven stability

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

Recently: every ~12 days

Total

14

Last Release

29d ago

Major Versions

1.2.0 → v2.0.22026-03-27

PHP version history (2 changes)v1.0.1PHP &gt;=5.4.0

v2.0.2PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/860e51ee755b1838ef4a421d3070ba03b57b7bfb3485f85ee5a41ee59bf75456?d=identicon)[aalonzolu](/maintainers/aalonzolu)

---

Top Contributors

[![aalonzolu](https://avatars.githubusercontent.com/u/5524124?v=4)](https://github.com/aalonzolu "aalonzolu (61 commits)")

---

Tags

e-invoicingsatfacturaGuatemalafeldigifact

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aalonzolu-digifact/health.svg)

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

###  Alternatives

[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[phpcfdi/sat-ws-descarga-masiva

Librería para usar el servicio web del SAT de Descarga Masiva

17782.3k3](/packages/phpcfdi-sat-ws-descarga-masiva)[facturapi/facturapi-php

Facturapi's PHP client library

1550.1k](/packages/facturapi-facturapi-php)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k14](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)[phpcfdi/finkok

Librería para conectar con la API de servicios de FINKOK

2214.1k](/packages/phpcfdi-finkok)

PHPackages © 2026

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