danielbbarcelos/laravel-notas-fiscais
Laravel Notas Fiscais is a package by danielbbarcelos that helps Laravel/PHP applications work with Brazilian fiscal notes, offering integration helpers and tooling to issue, query, and manage notas fiscais more easily.
composer require danielbbarcelos/laravel-notas-fiscais then publish config: php artisan vendor:publish --tag=notas-fiscais-config. Everything you need lives in config/notas-fiscais.php — that file is the first place to look, since drivers, certificates and (as of v1.2.0) proxies are all declared there.http/socks proxy block to that driver's config and the request is tunnelled out through it — no code changes, no separate deployment.Driver-level proxy is the new lever. The whole point of the feature is that it is per driver, not global. Model it that way:
'drivers' => [
'prefeitura_x' => [
'driver' => \Danielbbarcelos\NotasFiscais\Drivers\IssNet::class,
'proxy' => [
'url' => env('NF_PROXY_URL'), // http://user:pass@host:port or socks5://...
'timeout' => 30,
],
],
],
Exact key names may differ from the snippet above — verify against the published config and the driver's own docblock before rolling out.
Wrap emission in a queued job. NFS-e endpoints are slow and flaky, and a proxy adds latency on top. A job with $tries, $backoff and a ShouldBeUnique key on (tenant, RPS number) will save you from duplicate notes when a timeout occurs after the municipality has already processed the request.
Multi-tenant runtime switching. If one app serves several municipalities, resolve the driver per tenant rather than per config file: build the config array at runtime and hand it to the driver. Keep proxy settings in a per-tenant column or a secrets store — different tenants will egress through different proxies, some with credentials.
Separate homologação and produção drivers. Give each environment its own driver entry, each with its own proxy if needed. Production proxies are usually IP-whitelisted; you do not want a staging run consuming the same egress IP quota or, worse, emitting to the production endpoint.
Test against a stubbed HTTP layer. Laravel's Http::fake() covers the cases where the driver uses the HTTP client; for SOAP-based drivers, point the WSDL/endpoint at a local fixture. Assert on the outbound request, not just the returned DTO, so you catch a missing or malformed proxy configuration in CI rather than in production.
Log the egress IP on boot. A one-line check against https://ifconfig.me (or the municipality's own echo endpoint) through the configured proxy at deploy time turns "why is the prefeitura returning 403?" into a five-second answer.
php artisan config:cache after any proxy/env change, and remember that env() calls inside a cached config are resolved at cache time — a per-tenant proxy read via env() at runtime will silently return null.--timeout exceeds them, or you get killed jobs mid-emission.curl -x $PROXY_URL https://ifconfig.me from the app host, (2) the same through the driver's logger, (3) confirm the driver picked up the proxy config (config('notas-fiscais.drivers.<name>.proxy')), (4) only then look at the municipality's error payload. Steps 1–3 solve almost everything.How can I help you explore Laravel packages today?