You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Emitting NFS-e in Brazil involves XML signing with ICP-Brasil certificates, SOAP/REST calls to multiple municipal gateways, and safe credential management — all of which most accounting software gets wrong.
21
-
22
-
**nfse-php** handles all of it correctly:
23
-
24
-
-**XML signing** with PFX/PKCS#12 certificates (native PHP first, CLI repack fallback for OpenSSL legacy format)
25
-
-**Credential isolation** — PFX passwords are never stored in your database; they live in [OpenBao](https://openbao.org/) / HashiCorp Vault KV v2
26
-
-**Pluggable secret store** — swap OpenBao for any `SecretStoreInterface` implementation
27
-
-**Tier-1 tests always run** via `donatj/mock-webserver` (no real cert required in CI)
28
-
-**Strict PHP 8.2+ types** throughout
29
-
30
-
---
18
+
- Emit NFS-e (`emit`)
19
+
- Query NFS-e (`query`)
20
+
- Cancel NFS-e (`cancel`)
21
+
- Retrieve DANFSE bytes (`getDanfse`)
22
+
- Sign DPS XML with PFX credentials
23
+
- Read secrets from OpenBao/Vault or an in-memory store
31
24
32
25
## Requirements
33
26
@@ -38,25 +31,30 @@ Emitting NFS-e in Brazil involves XML signing with ICP-Brasil certificates, SOAP
38
31
| ext-dom | * |
39
32
| ext-soap | * |
40
33
41
-
---
42
-
43
34
## Installation
44
35
45
36
```bash
46
37
composer require librecodeoop/nfse-php
47
38
```
48
39
49
-
---
50
-
51
40
## Quick Start
52
41
53
42
```php
43
+
use LibreCodeCoop\NfsePHP\Config\CertConfig;
44
+
use LibreCodeCoop\NfsePHP\Config\EnvironmentConfig;
45
+
use LibreCodeCoop\NfsePHP\Dto\DpsData;
54
46
use LibreCodeCoop\NfsePHP\Http\NfseClient;
55
47
use LibreCodeCoop\NfsePHP\SecretStore\OpenBaoSecretStore;
56
-
use LibreCodeCoop\NfsePHP\Dto\DpsData;
57
48
58
49
$store = new OpenBaoSecretStore(addr: 'http://localhost:8200', token: getenv('VAULT_TOKEN'));
59
-
$client = new NfseClient(secretStore: $store, sandboxMode: true);
50
+
$env = new EnvironmentConfig(sandboxMode: true);
51
+
$cert = new CertConfig(
52
+
cnpj: '11222333000181',
53
+
pfxPath: '/secure/path/certificate.pfx',
54
+
vaultPath: 'pfx/11222333000181',
55
+
);
56
+
57
+
$client = new NfseClient(environment: $env, cert: $cert, secretStore: $store);
60
58
61
59
$dps = new DpsData(
62
60
cnpjPrestador: '11222333000181', // Example only: configure with your provider CNPJ
For development/CI without OpenBao, use `NoOpSecretStore` which reads directly from constructor arguments and never touches any server.
97
-
98
-
---
99
-
100
-
## Roadmap
101
-
102
-
-[x] DPS issuance via SEFIN Nacional REST API
103
-
-[x] XML signing (PFX, ICP-Brasil)
104
-
-[x] OpenBao / Vault KV v2 secret store
105
-
-[x] Mock webserver for CI-friendly testing
106
-
-[ ] NFS-e query (GET /dps/{id})
107
-
-[ ] NFS-e cancellation
108
-
-[ ] Webhook / event polling
109
-
-[ ] Municipal gateway adapters beyond Niterói
110
-
111
-
---
112
-
113
-
## Commercial Support
114
-
115
-
This library is the foundation of the [akaunting-nfse](https://github.com/LibreCodeCoop/akaunting-nfse) module for [Akaunting](https://akaunting.com/).
116
-
117
-
Need SLA-backed support, custom municipal adapters, or managed hosting?
118
-
Contact us: **comercial@librecodecoop.org.br**
119
-
120
-
---
90
+
For development/CI without OpenBao, use `NoOpSecretStore` (in-memory only, no server calls).
121
91
122
92
## Contributing
123
93
124
-
We welcome issues and pull requests. Please read [CONTRIBUTING.md](CONTRIBUTING.md) before opening a PR.
125
-
126
94
All commits must use [Conventional Commits](https://www.conventionalcommits.org/) and be signed off (`git commit -s`).
127
95
128
-
---
129
-
130
-
## Give us a star!
131
-
132
-
If this library saves you hours of integration pain, please ⭐ the repository.
133
-
It helps other developers discover the project and motivates the team to keep improving it.
134
-
135
-
---
136
-
137
96
## License
138
97
139
98
GNU Affero General Public License v3.0 or later — see [LICENSES/AGPL-3.0-or-later.txt](LICENSES/AGPL-3.0-or-later.txt).
0 commit comments