PHPackages                             librecodeoop/nfse-php - 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. librecodeoop/nfse-php

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

librecodeoop/nfse-php
=====================

Framework-agnostic PHP library for NFS-e issuance, query and cancellation via SEFIN Nacional (ABRASF 2.04 / SEFIN 1.0)

1750↓90%PHPCI passing

Since Apr 23Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/LibreCodeCoop/nfse-php)[ Packagist](https://packagist.org/packages/librecodeoop/nfse-php)[ RSS](/packages/librecodeoop-nfse-php/feed)WikiDiscussions main Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

nfse-php
========

[](#nfse-php)

> Framework-agnostic PHP library for issuing, querying, and cancelling **Nota Fiscal de Serviço Eletrônica (NFS-e)** via SEFIN Nacional (ABRASF 2.04 / SEFIN 1.0).

[![Latest Version](https://camo.githubusercontent.com/42b6fc7a5c85651ca75dd722ebdea29e84cfa58994eb793e31cf8b92e9989fed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c69627265636f64656f6f702f6e6673652d7068703f7374796c653d666c61742d737175617265)](https://packagist.org/packages/librecodeoop/nfse-php)[![PHP Version](https://camo.githubusercontent.com/0e8a86500c7e8e28e2088c68ab6183c334a255a0858ffd127029f030f47cfca8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c69627265636f64656f6f702f6e6673652d7068703f7374796c653d666c61742d737175617265)](https://packagist.org/packages/librecodeoop/nfse-php)[![License: AGPL v3](https://camo.githubusercontent.com/cf11be7ac71014b9a38c364f4cc510b2c2a3495034fcff0466c62da78f2e876d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4147504c5f76332d626c75652e7376673f7374796c653d666c61742d737175617265)](https://www.gnu.org/licenses/agpl-3.0)[![CI](https://github.com/LibreCodeCoop/nfse-php/actions/workflows/phpunit.yml/badge.svg)](https://github.com/LibreCodeCoop/nfse-php/actions/workflows/phpunit.yml)[![codecov](https://camo.githubusercontent.com/9fd89dd9c0e51878acb8694bdd15bb6dda4bea30162045374b548d1aa4e2be65/68747470733a2f2f636f6465636f762e696f2f67682f4c69627265436f6465436f6f702f6e6673652d7068702f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/LibreCodeCoop/nfse-php)

Scope
-----

[](#scope)

- Emit NFS-e (`emit`)
- Query NFS-e (`query`)
- Cancel NFS-e (`cancel`)
- Retrieve DANFSE bytes (`getDanfse`)
- Sign DPS XML with PFX credentials
- Read secrets from OpenBao/Vault or an in-memory store

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

[](#installation)

```
composer require librecodeoop/nfse-php
```

Quick Start
-----------

[](#quick-start)

```
use LibreCodeCoop\NfsePHP\Config\CertConfig;
use LibreCodeCoop\NfsePHP\Config\EnvironmentConfig;
use LibreCodeCoop\NfsePHP\Dto\DpsData;
use LibreCodeCoop\NfsePHP\Http\NfseClient;
use LibreCodeCoop\NfsePHP\SecretStore\OpenBaoSecretStore;

$store  = new OpenBaoSecretStore(addr: 'http://localhost:8200', token: getenv('VAULT_TOKEN'));
$env    = new EnvironmentConfig(sandboxMode: true);
$cert   = new CertConfig(
    cnpj: '11222333000181',
    pfxPath: '/secure/path/certificate.pfx',
    vaultPath: 'pfx/11222333000181',
);

$client = new NfseClient(environment: $env, cert: $cert, secretStore: $store);

$dps = new DpsData(
    cnpjPrestador: '11222333000181', // Example only: configure with your provider CNPJ
    municipioIbge: '3303302',
    // ... other fields
);

$receipt = $client->emit($dps);
echo $receipt->nfseNumber; // NFS-e number returned by the SEFIN gateway
```

Secret Storage with OpenBao
---------------------------

[](#secret-storage-with-openbao)

PFX passwords are stored in OpenBao (or Vault) KV v2, for example in `nfse/pfx/{cnpj}`.

```
use LibreCodeCoop\NfsePHP\SecretStore\OpenBaoSecretStore;

$store = new OpenBaoSecretStore(
    addr:      getenv('VAULT_ADDR'),   // e.g. http://openbao:8200
    roleId:    getenv('VAULT_ROLE_ID'),
    secretId:  getenv('VAULT_SECRET_ID'),
    mount:     'nfse',               // KV v2 mount
);

// Store the PFX password after upload
$store->put('pfx/11222333000181', ['password' => 'secret']);

// Retrieve during signing
$password = $store->get('pfx/11222333000181')['password'];
```

For development/CI without OpenBao, use `NoOpSecretStore` (in-memory only, no server calls).

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

[](#contributing)

All commits must use [Conventional Commits](https://www.conventionalcommits.org/) and be signed off (`git commit -s`).

Give us a star!
---------------

[](#give-us-a-star)

If this library saves you hours of integration pain, please ⭐ the repository.
It helps other developers discover the project and motivates the team to keep improving it.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance57

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity11

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/32546069?v=4)[LibreCode coop](/maintainers/librecodecoop)[@LibreCodeCoop](https://github.com/LibreCodeCoop)

---

Top Contributors

[![vitormattos](https://avatars.githubusercontent.com/u/1079143?v=4)](https://github.com/vitormattos "vitormattos (133 commits)")

### Embed Badge

![Health badge](/badges/librecodeoop-nfse-php/health.svg)

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

###  Alternatives

[guava/calendar

Adds support for vkurko/calendar to Filament PHP.

307374.3k3](/packages/guava-calendar)

PHPackages © 2026

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