marcelofecchio/correios-api
Laravel/PHP package that provides a clean integration with the Correios API for Brazilian e-commerce applications. Simplifies shipping rate calculations, delivery tracking, and other Correios services through a configurable wrapper that reduces boilerplate.
Architecture fit
Pessoa) carrying serialized attributes, an error taxonomy rooted at ErroApi, and orchestration types (PrePostagemCriada, ProcessamentoAssincrono). v0.5.0 extends each layer consistently rather than inventing a parallel path — ErroContribuinteIcms subclasses ErroApi, contribuinte_icms joins the existing Pessoa array/remetente_padrao shape, and detection helpers are exposed on the two result objects that already surface failure state.ErroValidacao on emiteDCe (fail fast, no API call) and a post-hoc detection path for Rejeição 812 arriving through synchronous responses or asynchronous processing. This dual placement matches how the Correios/SEFAZ interaction actually fails and is the right shape for a TPM to plan around.ErroContribuinteIcms::reconhece() matches on message text and causa text rather than a stable rejection code. That is a string-contract dependency on an external system whose exact output the maintainer explicitly states has not been observed. Treat this as a knowingly provisional detection layer, not a durable invariant.Integration feasibility
contribuinteIcms: true, existing DC-e flows are unchanged. No forced migration of current callers, no signature breaks indicated.chaveNFe instead of emiteDCe for those senders. The package now blocks the wrong path but does not implement the correct one — that work is ours.contribuinte_icms is a new attribute on Pessoa, so any locally stored sender records, fixtures, seeders, or API resources with strict validation/serialization need review.Technical risk
ErroApi — users retry, postagens are wasted, and the failure looks like an outage rather than a fiscal rule.contribuinteIcms flag. Mis-flagging in either direction is costly: false on a taxpayer means hard rejection at volume after the deadline; true on a non-taxpayer means a self-inflicted block on legitimate DC-e emission.ProcessamentoAssincrono::recusadaPorContribuinteIcms()) means failures can appear long after submission, in batch/webhook processing, where they are easiest to miss.Key questions
chaveNFe end-to-end, including NF-e key validation and capture from the fiscal pipeline?Pessoa persisted in our app — is a schema/column change required, and what is the backfill plan?contribuinteIcms blocks legitimate volume in production?Stack fit
Pessoa remains a value/DTO-style object, so the integration is data plumbing rather than new architecture.ErroContribuinteIcms in job middleware or the queue failure handler and render it as a non-retryable, user-actionable error; a generic ErroApi catch will otherwise burn retry budget on a permanently invalid request.ErroValidacao on field emiteDCe to the sender-configuration screen so the fix is discoverable at the point of failure rather than buried in a log.Migration path
contribuinte_icms from the cadastro's IE status, store it alongside sender records, and reconcile a sample manually with the fiscal team before trusting the flag.chaveNFe path already available so blocked senders have an immediate correct alternative.Compatibility
composer.json before scheduling.Pessoa array by fixed key list or strict schema — the added contribuinte_icms key and its appearance in remetente_padrao can trip strict validators, snapshot tests, or API resource whitelists.0.5.x) rather than floating, given pre-1.0 and an unverified detection contract.Sequencing
contribuinteIcms backfill (data work is the long pole — start first).chaveNFe emission path for taxpayer senders.Maintenance
Support
emiteDCe, (b) SEFAZ Rejeição 812 detected synchronously, (c) 812 discovered asynchronously on an already-submitted pré-postagem, and (d) an unrecognized rejection that should have been 812.Scaling
Failure modes
true → legitimate DC-e emission refused locally with no external error to explain it. Highest-severity self-inflicted mode.motivoCancelamento or async failure messages, never surfaced to an operator.Ramp-up
How can I help you explore Laravel packages today?