librecodeoop/nfse-php
Composer 安装命令:
composer require librecodeoop/nfse-php
包简介
Framework-agnostic PHP library for NFS-e issuance, query and cancellation via SEFIN Nacional (ABRASF 2.04 / SEFIN 1.0)
README 文档
README
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).
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
composer require librecodeoop/nfse-php
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
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
All commits must use Conventional Commits and be signed off (git commit -s).
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.
librecodeoop/nfse-php 适用场景与选型建议
librecodeoop/nfse-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 749 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 04 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「brazil」 「nfse」 「fiscal」 「nfse-php」 「nota-fiscal」 「xml-signing」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 librecodeoop/nfse-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 librecodeoop/nfse-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 librecodeoop/nfse-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Pacote para utilização do Plugnotas em PHP
PHP extension with Brazilian states and formats for CPF, CNPJ and ZIP
A FilamentPHP plugin that validates Brazilian postal codes (CEP) and automatically fills address fields (street, neighborhood, city, state, country) using ViaCEP as the primary source, with multiple API fallbacks for reliability.
Um php-client melhorado para a integração com oa maravilhosa API do https://enotas.com.br/gateway. Apenas V1(por enquanto)
Biblioteca para geração de NFSE de Belo Horizonte
Moip integration with Magento 2
统计信息
- 总下载量: 749
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 34
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0-or-later
- 更新时间: 2026-04-01