Documentation

Tools extends Tools
in package
uses TraitEPECNfce, TraitEventsRTC

Table of Contents

Constants

EVT_ATORINTERESSADO  = 110150
EVT_CANCELA  = 110111
EVT_CANCELA_CONCILIACAO  = 110751
EVT_CANCELA_INSUCESSO_ENTREGA  = 110193
EVT_CANCELA_PRORROGACAO_1  = 111502
EVT_CANCELA_PRORROGACAO_2  = 111503
EVT_CANCELAMENTO_COMPROVANTE_ENTREGA  = 110131
EVT_CANCELASUBSTITUICAO  = 110112
EVT_CCE  = 110110
EVT_CIENCIA  = 210210
EVT_COMPROVANTE_ENTREGA  = 110130
EVT_CONCILIACAO  = 110750
EVT_CONFIRMACAO  = 210200
EVT_DESCONHECIMENTO  = 210220
EVT_EPEC  = 110140
EVT_INSUCESSO_ENTREGA  = 110192
EVT_NAO_REALIZADA  = 210240
EVT_PRORROGACAO_1  = 111500
EVT_PRORROGACAO_2  = 111501

Properties

$ambiente  : string
ambiente
$config  : stdClass
config class
$contingency  : Contingency|null
contingency class
$cUF  : int
$lastRequest  : string
last soap request
$lastResponse  : string
last soap response
$pathschemes  : string
Path to schemes folder
$pathwsfiles  : string
Path to storage folder
$soap  : SoapInterface|null
soap class
$tpAmb  : int
Environment
$verAplic  : string
Application version
$algorithm  : int
Sign algorithm from OPENSSL
$availableVersions  : array<string|int, mixed>
$canonical  : array<string|int, mixed>
Canonical conversion options
$certificate  : Certificate
certificate class
$modelo  : int
Model of NFe 55 or 65
$objHeader  : SoapHeader|null
$qrcode_version  : string|null
$soapnamespaces  : array<string|int, mixed>
$timezone  : string
$typePerson  : string
$urlAction  : string
$urlcUF  : int
urlcUF
$urlHeader  : string
$urlMethod  : string
$urlNamespace  : string
$urlOperation  : string
$urlPortal  : string
urlPortal Instância do WebService
$urlService  : string
urlService
$urlVersion  : string
urlVersion
$versao  : string
Version of layout

Methods

__construct()  : mixed
Loads configurations and Digital Certificate, map all paths, set timezone and instanciate Contingency::class
canonicalOptions()  : array<string|int, mixed>
Set option for canonical transformation see C14n
forceQRCodeVersion()  : void
Force use this version for QRCode format in NFCe
getAcronym()  : string
Recover state acronym from cUF number
getcUF()  : int
Recover cUF number from state acronym
getTypeOfPersonFromCertificate()  : string
Return J or F from existing type in ASN.1 certificate J - pessoa juridica (CNPJ) F - pessoa física (CPF)
loadSoapClass()  : void
Load Soap Class Soap Class may be \NFePHP\Common\Soap\SoapNative or \NFePHP\Common\Soap\SoapCurl
model()  : int
Set or get model of document NFe = 55 or NFCe = 65
sefazAceiteDebito()  : string
Evento: Aceite de débito na apuração por emissão de nota de crédito Permitir ao destinatário informar que concorda com os valores constantes em nota de crédito emitida pelo fornecedor ou pelo adquirente que serão lançados a débito na apuração assistida de IBS e CBS.
sefazApropriacaoCreditoBens()  : string
Evento: Solicitação de Apropriação de Crédito para bens e serviços que dependem de atividade do adquirente Evento a ser gerado pelo adquirente para apropriação de crédito de bens e serviços que dependam da sua atividade Modelo: NF-e modelo 55, Autor do Evento: Destinatário da NFe (adquirente), Código do Tipo de Evento: 211150
sefazApropriacaoCreditoComb()  : string
Evento: Solicitação de Apropriação de Crédito de Combustível Evento a ser gerado pelo adquirente de combustível listado no art. 172 da LC 214/2025 e que pertença à cadeia produtiva desses combustíveis, para solicitar a apropriação de crédito referente à parcela que for consumida em sua atividade comercial.
sefazAtorInteressado()  : string
Evento do Ator Interessado NOTA: NT2020.007_v1.00a
sefazAtualizacaoDataEntrega()  : string
Evento: Atualização da Data de Previsão de Entrega Função: Permitir ao fornecedor atualizar a data da previsão de entrega ou disponibilização do bem ao adquirente, de forma à remover o débito do mês em que foi previsto inicialmente.
sefazCadastro()  : string
Search for the registration data of an NFe issuer, if in contingency mode this service will cause a Exception and remember not all Sefaz have this service available, so it will not work in some cases.
sefazCancela()  : string
Requires nfe cancellation
sefazCancelaEvento()  : string
Evento: Cancelamento de Evento Permitir que o autor de um Evento já autorizado possa proceder o seu cancelamento.
sefazCancelaPorSubstituicao()  : string
Requires nfe cancellation by substitution
sefazCCe()  : string
Request authorization for Letter of Correction
sefazComprovanteEntrega()  : string
Send event for delivery receipt
sefazConciliacao()  : string
Request event of financial reconciliation
sefazConsultaChave()  : string
Check the NFe status for the 44-digit key and retrieve the protocol
sefazConsultaRecibo()  : string
Check status of Batch of NFe sent by receipt of this shipment
sefazCsc()  : string
Maintenance of the Taxpayer Security Code - CSC (Old Token)
sefazDestinoConsumoPessoal()  : string
Evento: Destinação de item para consumo pessoal Permitir ao adquirente informar quando uma aquisição for destinada para o consumo de pessoa física, hipótese em que não haverá direito à apropriação de crédito.
sefazDistDFe()  : string
Service for the distribution of summary information and electronic tax documents of interest to an actor.
sefazDownload()  : string
Request the NFe download already manifested by its recipient, by the key using new service in NfeDistribuicaoDFe NOTA: NfeDownloadNF is deactivated
sefazECPP()  : string
Request the cancellation of the request for an extension of the term of return of products of an NF-e of consignment for industrialization by order with suspension of ICMS in interstate operations
sefazEnviaLote()  : string
Request authorization to issue NFe in batch with one or more documents
sefazEPEC()  : string
Request authorization for issuance in contingency EPEC
sefazEpecNfce()  : string
Request authorization for issuance in contingency EPEC for NFCe in SP only
sefazEPP()  : string
Request extension of the term of return of products of an NF-e of consignment for industrialization to order with suspension of ICMS in interstate operations
sefazEvento()  : string
Send event to SEFAZ
sefazEventoLote()  : string
Send event to SEFAZ in batch
sefazFornecimentoNaoRealizado()  : string
Evento: Fornecimento não realizado com pagamento antecipado Permitir ao fornecedor informar que um pagamento antecipado não teve o respectivo fornecimento realizado.
sefazImobilizacaoItem()  : string
Evento: Imobilização de Item Evento a ser gerado pelo adquirente de bem, quando este for integrado ao seu ativo imobilizado, a fim de viabilizar a adequada identificação, pelos sistemas da administração tributária, de prazo-limite para apreciação de eventuais pedidos de ressarcimento do respectivo crédito, nos termos do art. 40, I da LC 214/2025.
sefazImportacaoZFM()  : string
Evento: Importação em ALC/ZFM não convertida em isenção Permitir que o adquirente das regiões incentivadas (ALC/ZFM) informe que a tributação na importação não se converteu em isenção de um determinado item por não atender as condições da legislação.
sefazInfoPagtoIntegral()  : string
Evento: Informação de efetivo pagamento integral para liberar crédito presumido do adquirente Permitir que o emitente da NFe informe o efetivo pagamento integral a fim de liberar crédito presumido do adquirente Modelo: NF-e modelo 55, Autor do Evento: Emitente da NFe, Código do Tipo de Evento: 112110
sefazInsucessoEntrega()  : string
Request event of delivery failure or cancellation of registered delivery failure event
sefazInutiliza()  : string
Request to disable one or an NFe sequence of a given series
sefazManifesta()  : string
Request the registration of the manifestation of recipient
sefazManifestacaoTransfCredCBS()  : string
Evento: Manifestação sobre Pedido de Transferência de Crédito de CBS em Operações de Sucessão Evento a ser gerado pela sucessora em relação às notas fiscais de transferência de crédito de outra sucessora da mesma empresa sucedida para informar aceite da transferência de crédito de CBS.
sefazManifestacaoTransfCredIBS()  : string
Evento: Manifestação sobre Pedido de Transferência de Crédito de IBS em Operações de Sucessão Evento a ser gerado pela sucessora em relação às notas fiscais de transferência de crédito de outra sucessora da mesma empresa sucedida para informar aceite da transferência de crédito de IBS.
sefazManifestaLote()  : string
Request the registration of the manifestation of recipient in batch
sefazRouboPerdaTransporteAdquirente()  : string
Evento: Perecimento, perda, roubo ou furto durante o transporte contratado pelo adquirente Permitir ao adquirente informar quando uma aquisição for objeto de roubo, perda, furto ou perecimento.
sefazRouboPerdaTransporteFornecedor()  : string
Evento: Perecimento, perda, roubo ou furto durante o transporte contratado pelo fornecedor Permitir ao fornecedor informar quando um bem for objeto de roubo, perda, furto ou perecimento antes da entrega, durante o transporte contratado pelo fornecedor.
sefazSolApropCredPresumido()  : string
Evento: Solicitação de Apropriação de crédito presumido Evento a ser gerado pelo adquirente, em relação às notas fiscais de aquisição de emissão de terceiros e que lhe gerem o dire ito à apropriação de crédito presumido.
sefazStatus()  : string
Check services status SEFAZ/SVC If $uf is empty use normal check with contingency If $uf is NOT empty ignore contingency mode
sefazStatusEpecNfce()  : string
Check services status EPEC NFCE SEFAZ-SP only
sefazValidate()  : bool
Checks the validity of an NFe, normally used for received NFe
setEnvironment()  : void
Alter environment from "homologacao" to "producao" and vice-versa
setEnvironmentTimeZone()  : void
Sets environment time zone
setSignAlgorithm()  : void
Set OPENSSL Algorithm using OPENSSL constants
setVerAplic()  : void
Set application version
signNFe()  : string
Sign NFe or NFCe
validKeyByUF()  : string
Validate cUF from the key content and returns the state acronym
version()  : string
Set or get parameter layout version
addQRCode()  : string
Add QRCode Tag to signed XML from a NFCe
checkContingencyForWebServices()  : void
Verifies the existence of the service
checkModel()  : void
Somente aceitar modelo 55
checkModelFromXml()  : void
Verify if xml model is equal as modelo property
checkSoap()  : mixed
Verify if SOAP class is loaded, if not, force load SoapCurl
correctNFeForContingencyMode()  : string
Corrects NFe fields when in contingency mode
getURIConsultaNFCe()  : string
Get URI for search NFCe by key (chave)
getXmlUrlPath()  : string
Recover path to xml database with list of soap services
isValid()  : bool
Performs xml validation with its respective XSD structure definition document NOTE: if don't exists the XSD file will return true
resolveVerAplic()  : string
Resolve variavel verAplic
sendRequest()  : string
Send request message to webservice
servico()  : void
Assembles all the necessary parameters for soap communication
tagdetPag()  : false|string
Cria detPag para Consciliação financeira
tpEv()  : stdClass
Returns alias and description event from event code.

Constants

EVT_ATORINTERESSADO

public mixed EVT_ATORINTERESSADO = 110150

EVT_CANCELA

public mixed EVT_CANCELA = 110111

EVT_CANCELA_CONCILIACAO

public mixed EVT_CANCELA_CONCILIACAO = 110751

EVT_CANCELA_INSUCESSO_ENTREGA

public mixed EVT_CANCELA_INSUCESSO_ENTREGA = 110193

EVT_CANCELA_PRORROGACAO_1

public mixed EVT_CANCELA_PRORROGACAO_1 = 111502

EVT_CANCELA_PRORROGACAO_2

public mixed EVT_CANCELA_PRORROGACAO_2 = 111503

EVT_CANCELAMENTO_COMPROVANTE_ENTREGA

public mixed EVT_CANCELAMENTO_COMPROVANTE_ENTREGA = 110131

EVT_CANCELASUBSTITUICAO

public mixed EVT_CANCELASUBSTITUICAO = 110112

EVT_CCE

public mixed EVT_CCE = 110110

EVT_CIENCIA

public mixed EVT_CIENCIA = 210210

EVT_COMPROVANTE_ENTREGA

public mixed EVT_COMPROVANTE_ENTREGA = 110130

EVT_CONCILIACAO

public mixed EVT_CONCILIACAO = 110750

EVT_CONFIRMACAO

public mixed EVT_CONFIRMACAO = 210200

EVT_DESCONHECIMENTO

public mixed EVT_DESCONHECIMENTO = 210220

EVT_EPEC

public mixed EVT_EPEC = 110140

EVT_INSUCESSO_ENTREGA

public mixed EVT_INSUCESSO_ENTREGA = 110192

EVT_NAO_REALIZADA

public mixed EVT_NAO_REALIZADA = 210240

EVT_PRORROGACAO_1

public mixed EVT_PRORROGACAO_1 = 111500

EVT_PRORROGACAO_2

public mixed EVT_PRORROGACAO_2 = 111501

Properties

$ambiente

ambiente

public string $ambiente = 'homologacao'

$config

config class

public stdClass $config

$lastRequest

last soap request

public string $lastRequest = ''

$lastResponse

last soap response

public string $lastResponse = ''

$pathschemes

Path to schemes folder

public string $pathschemes = ''

$pathwsfiles

Path to storage folder

public string $pathwsfiles = ''

$soap

soap class

public SoapInterface|null $soap

$tpAmb

Environment

public int $tpAmb = 2

$verAplic

Application version

public string $verAplic = ''

$algorithm

Sign algorithm from OPENSSL

protected int $algorithm = OPENSSL_ALGO_SHA1

$availableVersions

protected array<string|int, mixed> $availableVersions = ['4.00' => 'PL_009_V4']

$canonical

Canonical conversion options

protected array<string|int, mixed> $canonical = [true, false, null, null]

$certificate

certificate class

protected Certificate $certificate

$modelo

Model of NFe 55 or 65

protected int $modelo = 55

$objHeader

protected SoapHeader|null $objHeader = null

$qrcode_version

protected string|null $qrcode_version = null

$soapnamespaces

protected array<string|int, mixed> $soapnamespaces = ['xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance", 'xmlns:xsd' => "http://www.w3.org/2001/XMLSchema", 'xmlns:soap' => "http://www.w3.org/2003/05/soap-envelope"]

$timezone

protected string $timezone

$typePerson

protected string $typePerson = 'J'

$urlAction

protected string $urlAction = ''

$urlcUF

urlcUF

protected int $urlcUF

$urlHeader

protected string $urlHeader = ''

$urlMethod

protected string $urlMethod = ''

$urlNamespace

protected string $urlNamespace = ''

$urlOperation

protected string $urlOperation = ''

$urlPortal

urlPortal Instância do WebService

protected string $urlPortal = 'http://www.portalfiscal.inf.br/nfe'

$urlService

urlService

protected string $urlService = ''

$urlVersion

urlVersion

protected string $urlVersion = ''

$versao

Version of layout

protected string $versao = '4.00'

Methods

__construct()

Loads configurations and Digital Certificate, map all paths, set timezone and instanciate Contingency::class

public __construct(string $configJson, Certificate $certificate[, Contingency|null $contingency = null ]) : mixed
Parameters
$configJson : string
$certificate : Certificate
$contingency : Contingency|null = null

canonicalOptions()

Set option for canonical transformation see C14n

public canonicalOptions([array<string|int, mixed> $opt = [true, false, null, null] ]) : array<string|int, mixed>
Parameters
$opt : array<string|int, mixed> = [true, false, null, null]
Return values
array<string|int, mixed>

forceQRCodeVersion()

Force use this version for QRCode format in NFCe

public forceQRCodeVersion(string $version) : void
Parameters
$version : string

getAcronym()

Recover state acronym from cUF number

public getAcronym(int $cUF) : string
Parameters
$cUF : int
Return values
string

getcUF()

Recover cUF number from state acronym

public getcUF(string $acronym) : int
Parameters
$acronym : string

Sigla do estado

Return values
int

number cUF

getTypeOfPersonFromCertificate()

Return J or F from existing type in ASN.1 certificate J - pessoa juridica (CNPJ) F - pessoa física (CPF)

public getTypeOfPersonFromCertificate() : string
Return values
string

loadSoapClass()

Load Soap Class Soap Class may be \NFePHP\Common\Soap\SoapNative or \NFePHP\Common\Soap\SoapCurl

public loadSoapClass(SoapInterface $soap) : void
Parameters
$soap : SoapInterface

model()

Set or get model of document NFe = 55 or NFCe = 65

public model([int|null $model = null ]) : int
Parameters
$model : int|null = null
Return values
int

modelo class parameter

sefazAceiteDebito()

Evento: Aceite de débito na apuração por emissão de nota de crédito Permitir ao destinatário informar que concorda com os valores constantes em nota de crédito emitida pelo fornecedor ou pelo adquirente que serão lançados a débito na apuração assistida de IBS e CBS.

public sefazAceiteDebito(stdClass $std[, string|null $verAplic = null ]) : string

Modelo: NF-e modelo 55, Autor do Evento: Destinatário da NF-e, Código do Tipo de Evento: 211128

$std = new stdClass; $std->chNFe = '12345678901234567890123456789012345678901234'; $std->nSeqEvento = 1; $std->dhEvento = '2025-09-23\T13:34:30-03:00'; $std->lote = null;

Parameters
$std : stdClass
$verAplic : string|null = null
Return values
string

sefazApropriacaoCreditoBens()

Evento: Solicitação de Apropriação de Crédito para bens e serviços que dependem de atividade do adquirente Evento a ser gerado pelo adquirente para apropriação de crédito de bens e serviços que dependam da sua atividade Modelo: NF-e modelo 55, Autor do Evento: Destinatário da NFe (adquirente), Código do Tipo de Evento: 211150

public sefazApropriacaoCreditoBens(stdClass $std[, string|null $verAplic = null ]) : string

$itens = []; $itens[] = [ 'item' => 1, 'vIBS' => 10.00, 'vCBS' => 10.00, ];

$std = new stdClass(); $std->chNFe = '12345678901234567890123456789012345678901234'; $std->nSeqEvento = 1; //opcional DEFAULT = 1 $std->itens = $itens;

Parameters
$std : stdClass
$verAplic : string|null = null
Return values
string

sefazApropriacaoCreditoComb()

Evento: Solicitação de Apropriação de Crédito de Combustível Evento a ser gerado pelo adquirente de combustível listado no art. 172 da LC 214/2025 e que pertença à cadeia produtiva desses combustíveis, para solicitar a apropriação de crédito referente à parcela que for consumida em sua atividade comercial.

public sefazApropriacaoCreditoComb(stdClass $std[, string|null $verAplic = null ]) : string

Modelo: NF-e modelo 55 Autor do Evento: Destinatário da NF-e (Adquirente de combustível parte da cadeia produtiva de combustíveis) Código do Tipo de Evento: 211140

$itens[1] = (object) [ 'item' => 1, 'vIBS' => 10.00, 'vCBS' => 10.00, 'quantidade' => 10, 'unidade' => 'LT' ];

$std = new stdClass; $std->chNFe = '12345678901234567890123456789012345678901234'; $std->nSeqEvento = 1; $std->dhEvento = '2025-09-23\T13:34:30-03:00'; $std->lote = null; $std->itens = $itens;

Parameters
$std : stdClass
$verAplic : string|null = null
Return values
string

sefazAtorInteressado()

Evento do Ator Interessado NOTA: NT2020.007_v1.00a

public sefazAtorInteressado(stdClass $std[, DateTimeInterface|null $dhEvento = null ][, string|null $lote = null ]) : string
Parameters
$std : stdClass
$dhEvento : DateTimeInterface|null = null
$lote : string|null = null
Return values
string

sefazAtualizacaoDataEntrega()

Evento: Atualização da Data de Previsão de Entrega Função: Permitir ao fornecedor atualizar a data da previsão de entrega ou disponibilização do bem ao adquirente, de forma à remover o débito do mês em que foi previsto inicialmente.

public sefazAtualizacaoDataEntrega(stdClass $std[, string|null $verAplic = null ]) : string

Modelo: NF-e modelo 55 Autor do Evento: emitente da NF-e Código do Tipo de Evento: 112150

Parameters
$std : stdClass
$verAplic : string|null = null
Return values
string

sefazCadastro()

Search for the registration data of an NFe issuer, if in contingency mode this service will cause a Exception and remember not all Sefaz have this service available, so it will not work in some cases.

public sefazCadastro(string $uf[, string $cnpj = '' ][, string $iest = '' ][, string $cpf = '' ]) : string
Parameters
$uf : string

federation unit (abbreviation)

$cnpj : string = ''

CNPJ number (optional)

$iest : string = ''

IE number (optional)

$cpf : string = ''

CPF number (optional)

Tags
throws
InvalidArgumentException
Return values
string

xml soap response

sefazCancela()

Requires nfe cancellation

public sefazCancela(string $chave, string $xJust, string $nProt[, DateTimeInterface|null $dhEvento = null ][, string|null $lote = null ]) : string
Parameters
$chave : string

key of NFe

$xJust : string

justificative 255 characters max

$nProt : string

protocol number

$dhEvento : DateTimeInterface|null = null
$lote : string|null = null
Tags
throws
InvalidArgumentException
Return values
string

sefazCancelaEvento()

Evento: Cancelamento de Evento Permitir que o autor de um Evento já autorizado possa proceder o seu cancelamento.

public sefazCancelaEvento(stdClass $std[, string|null $verAplic = null ]) : string

Modelo: NF-e modelo 55, Autor do Evento: O mesmo Autor do Evento que está sendo cancelado. Tipo de Evento (Código - Descrição): 110001 - Cancelamento de Evento

Parameters
$std : stdClass
$verAplic : string|null = null
Return values
string

sefazCancelaPorSubstituicao()

Requires nfe cancellation by substitution

public sefazCancelaPorSubstituicao(string $chave, string $xJust, string $nProt, string $chNFeRef[, string $verAplic = null ][, DateTimeInterface|null $dhEvento = null ][, string|null $lote = null ]) : string
Parameters
$chave : string

key of NFe

$xJust : string

justificative 255 characters max

$nProt : string

protocol number

$chNFeRef : string

key of New NFe

$verAplic : string = null

version of applicative

$dhEvento : DateTimeInterface|null = null
$lote : string|null = null
Tags
throws
InvalidArgumentException
Return values
string

sefazCCe()

Request authorization for Letter of Correction

public sefazCCe(string $chave, string $xCorrecao[, int $nSeqEvento = 1 ][, DateTimeInterface|null $dhEvento = null ][, string|null $lote = null ]) : string
Parameters
$chave : string
$xCorrecao : string
$nSeqEvento : int = 1
$dhEvento : DateTimeInterface|null = null
$lote : string|null = null
Tags
throws
InvalidArgumentException
Return values
string

sefazComprovanteEntrega()

Send event for delivery receipt

public sefazComprovanteEntrega(stdClass $std[, DateTimeInterface|null $dhEvento = null ][, string|null $lote = null ]) : string
Parameters
$std : stdClass
$dhEvento : DateTimeInterface|null = null
$lote : string|null = null
Return values
string

sefazConciliacao()

Request event of financial reconciliation

public sefazConciliacao(stdClass $std[, DateTimeInterface|null $dhEvento = null ][, string|null $lote = null ]) : string
Parameters
$std : stdClass
$dhEvento : DateTimeInterface|null = null
$lote : string|null = null
Tags
throws
DOMException
Return values
string

sefazConsultaChave()

Check the NFe status for the 44-digit key and retrieve the protocol

public sefazConsultaChave(string $chave[, int $tpAmb = null ]) : string
Parameters
$chave : string
$tpAmb : int = null
Tags
throws
InvalidArgumentException
Return values
string

sefazConsultaRecibo()

Check status of Batch of NFe sent by receipt of this shipment

public sefazConsultaRecibo(string $recibo[, int $tpAmb = null ]) : string
Parameters
$recibo : string
$tpAmb : int = null
Tags
throws
InvalidArgumentException
Return values
string

sefazCsc()

Maintenance of the Taxpayer Security Code - CSC (Old Token)

public sefazCsc(int $indOp) : string
Parameters
$indOp : int

Identificador do tipo de operação: 1 - Consulta CSC Ativos; 2 - Solicita novo CSC; 3 - Revoga CSC Ativo

Tags
throws
InvalidArgumentException
throws
RuntimeException
Return values
string

sefazDestinoConsumoPessoal()

Evento: Destinação de item para consumo pessoal Permitir ao adquirente informar quando uma aquisição for destinada para o consumo de pessoa física, hipótese em que não haverá direito à apropriação de crédito.

public sefazDestinoConsumoPessoal(stdClass $std[, string|null $verAplic = null ]) : string

Evento a ser registrado após a emissão da nota de bens destinados para uso e consumo pessoal. Uma mesma NFe de aquisição pode receber vários Eventos desse tipo, com nSeqEvento diferentes (eventos cumulativos). Modelo: NF-e modelo 55, Autor do Evento: Destinatário da NF-e, Código do Tipo de Evento: 211120 tpAutor => Caso NF-e de Importação, informar 1-Empresa Emitente, nos demais casos 2-Empresa destinatária.

$itens[1] = (object) [ 'item' => 1, 'vIBS' => 10.00, 'vCBS' => 10.00, 'quantidade' => 10, 'unidade' => 'PC' 'chave' => '12345678901234567890123456789012345678901234', 'nItem' => 1 ];

$std = new stdClass; $std->chNFe = '12345678901234567890123456789012345678901234'; //OBRIGATÓRIO $std->nSeqEvento = 1; //opcional DEFAULT = 1

Parameters
$std : stdClass
$verAplic : string|null = null
Return values
string

sefazDistDFe()

Service for the distribution of summary information and electronic tax documents of interest to an actor.

public sefazDistDFe([int $ultNSU = 0 ][, int $numNSU = 0 ][, string $chave = null ][, string $fonte = 'AN' ]) : string
Parameters
$ultNSU : int = 0

last NSU number recived

$numNSU : int = 0

NSU number you wish to consult

$chave : string = null
$fonte : string = 'AN'

data source 'AN' and for some cases it may be 'RS'

Return values
string

sefazDownload()

Request the NFe download already manifested by its recipient, by the key using new service in NfeDistribuicaoDFe NOTA: NfeDownloadNF is deactivated

public sefazDownload(string $chave) : string
Parameters
$chave : string
Tags
throws
InvalidArgumentException
Return values
string

sefazECPP()

Request the cancellation of the request for an extension of the term of return of products of an NF-e of consignment for industrialization by order with suspension of ICMS in interstate operations

public sefazECPP(string $chave, string $nProt, int $tipo[, int $nSeqEvento = 1 ][, DateTimeInterface|null $dhEvento = null ][, string|null $lote = null ]) : string
Parameters
$chave : string
$nProt : string
$tipo : int

1-primerio prazo, 2-segundo prazo

$nSeqEvento : int = 1
$dhEvento : DateTimeInterface|null = null
$lote : string|null = null
Tags
throws
InvalidArgumentException
Return values
string

sefazEnviaLote()

Request authorization to issue NFe in batch with one or more documents

public sefazEnviaLote(array<string|int, mixed> $aXml[, string $idLote = '' ][, int $indSinc = 0 ][, bool $compactar = false ][, array<string|int, mixed> &$xmls = [] ]) : string
Parameters
$aXml : array<string|int, mixed>

array of nfe's xml

$idLote : string = ''

lote number

$indSinc : int = 0

flag to use synchronous communication

$compactar : bool = false

flag to compress data with gzip

$xmls : array<string|int, mixed> = []

array with xmls substitutes if contigency is on

Tags
throws
InvalidArgumentException
Return values
string

soap response xml

sefazEPEC()

Request authorization for issuance in contingency EPEC

public sefazEPEC(string &$xml[, string $verAplic = null ]) : string
Parameters
$xml : string
$verAplic : string = null
Tags
throws
InvalidArgumentException
throws
RuntimeException
Return values
string

sefazEpecNfce()

Request authorization for issuance in contingency EPEC for NFCe in SP only

public sefazEpecNfce(string &$xml[, string|null $verAplic = null ]) : string
Parameters
$xml : string
$verAplic : string|null = null
Return values
string

sefazEPP()

Request extension of the term of return of products of an NF-e of consignment for industrialization to order with suspension of ICMS in interstate operations

public sefazEPP(string $chNFe, string $nProt[, array<string|int, mixed> $itens = [] ][, int $tipo = 1 ][, int $nSeqEvento = 1 ][, DateTimeInterface|null $dhEvento = null ][, string|null $lote = null ]) : string
Parameters
$chNFe : string
$nProt : string
$itens : array<string|int, mixed> = []
$tipo : int = 1

1-primerio prazo, 2-segundo prazo

$nSeqEvento : int = 1
$dhEvento : DateTimeInterface|null = null
$lote : string|null = null
Return values
string

sefazEvento()

Send event to SEFAZ

public sefazEvento(string $uf, string $chave, int $tpEvento[, int $nSeqEvento = 1 ][, string $tagAdic = '' ][, DateTimeInterface|null $dhEvento = null ][, string|null $lote = null ]) : string
Parameters
$uf : string
$chave : string
$tpEvento : int
$nSeqEvento : int = 1
$tagAdic : string = ''
$dhEvento : DateTimeInterface|null = null
$lote : string|null = null
Tags
throws
Exception
Return values
string

sefazEventoLote()

Send event to SEFAZ in batch

public sefazEventoLote(string $uf, stdClass $std[, DateTimeInterface|null $dhEvento = null ][, string|null $lote = null ]) : string
Parameters
$uf : string
$std : stdClass
$dhEvento : DateTimeInterface|null = null
$lote : string|null = null
Tags
throws
RuntimeException
throws
InvalidArgumentException
Return values
string

sefazFornecimentoNaoRealizado()

Evento: Fornecimento não realizado com pagamento antecipado Permitir ao fornecedor informar que um pagamento antecipado não teve o respectivo fornecimento realizado.

public sefazFornecimentoNaoRealizado(stdClass $std[, string|null $verAplic = null ]) : string

Modelo: NF-e modelo 55 Autor do Evento: emitente da NF-e de nota de débito do tipo 06 = Pagamento antecipado Código do Tipo de Evento: 112140

Parameters
$std : stdClass
$verAplic : string|null = null
Return values
string

sefazImobilizacaoItem()

Evento: Imobilização de Item Evento a ser gerado pelo adquirente de bem, quando este for integrado ao seu ativo imobilizado, a fim de viabilizar a adequada identificação, pelos sistemas da administração tributária, de prazo-limite para apreciação de eventuais pedidos de ressarcimento do respectivo crédito, nos termos do art. 40, I da LC 214/2025.

public sefazImobilizacaoItem(stdClass $std[, string|null $verAplic = null ]) : string

Modelo: NF-e modelo 55, Autor do Evento: Destinatário da NF-e (Adquirente), Código do Tipo de Evento: 211130

$itens[1] = (object) [ 'item' => 1, 'vIBS' => 10.00, 'vCBS' => 10.00, 'quantidade' => 10, 'unidade' => 'PC' ];

$std = new stdClass; $std->chNFe = '12345678901234567890123456789012345678901234'; $std->nSeqEvento = 1; $std->dhEvento = '2025-09-23\T13:34:30-03:00'; $std->lote = null; $std->itens = $itens;

Parameters
$std : stdClass
$verAplic : string|null = null
Return values
string

sefazImportacaoZFM()

Evento: Importação em ALC/ZFM não convertida em isenção Permitir que o adquirente das regiões incentivadas (ALC/ZFM) informe que a tributação na importação não se converteu em isenção de um determinado item por não atender as condições da legislação.

public sefazImportacaoZFM(stdClass $std[, string|null $verAplic = null ]) : string

Modelo: NF-e modelo 55, Autor do Evento: emitente da NFe (adquirente), Código do Tipo de Evento: 112120

Parameters
$std : stdClass
$verAplic : string|null = null
Tags
throws
Exception
Return values
string

sefazInfoPagtoIntegral()

Evento: Informação de efetivo pagamento integral para liberar crédito presumido do adquirente Permitir que o emitente da NFe informe o efetivo pagamento integral a fim de liberar crédito presumido do adquirente Modelo: NF-e modelo 55, Autor do Evento: Emitente da NFe, Código do Tipo de Evento: 112110

public sefazInfoPagtoIntegral(stdClass $std[, string|null $verAplic = null ]) : string

$std = (object) [ 'chNFe' => '12345678901234567890123456789012345678901234', //OBRIGATÓRIO 'nSeqEvento' => 1 //opcional, Default = 1 ];

Parameters
$std : stdClass
$verAplic : string|null = null
Return values
string

sefazInsucessoEntrega()

Request event of delivery failure or cancellation of registered delivery failure event

public sefazInsucessoEntrega(stdClass $std[, DateTimeInterface|null $dhEvento = null ][, string|null $lote = null ]) : string
Parameters
$std : stdClass
$dhEvento : DateTimeInterface|null = null
$lote : string|null = null
Tags
throws
Exception
Return values
string

sefazInutiliza()

Request to disable one or an NFe sequence of a given series

public sefazInutiliza(int $nSerie, int $nIni, int $nFin, string $xJust[, int $tpAmb = null ][, string $ano = null ]) : string
Parameters
$nSerie : int
$nIni : int
$nFin : int
$xJust : string
$tpAmb : int = null
$ano : string = null
Tags
throws
InvalidArgumentException
Return values
string

sefazManifesta()

Request the registration of the manifestation of recipient

public sefazManifesta(string $chave, int $tpEvento[, string $xJust = '' ][, int $nSeqEvento = 1 ][, DateTimeInterface|null $dhEvento = null ][, string|null $lote = null ]) : string
Parameters
$chave : string
$tpEvento : int
$xJust : string = ''

Justification for not carrying out the operation

$nSeqEvento : int = 1
$dhEvento : DateTimeInterface|null = null
$lote : string|null = null
Tags
throws
InvalidArgumentException
Return values
string

sefazManifestacaoTransfCredCBS()

Evento: Manifestação sobre Pedido de Transferência de Crédito de CBS em Operações de Sucessão Evento a ser gerado pela sucessora em relação às notas fiscais de transferência de crédito de outra sucessora da mesma empresa sucedida para informar aceite da transferência de crédito de CBS.

public sefazManifestacaoTransfCredCBS(stdClass $std[, string|null $verAplic = null ]) : string

Modelo: NF-e modelo 55, Autor: Empresa sucessora, Código do Tipo de Evento: 212120

$std = new stdClass; $std->chNFe = '12345678901234567890123456789012345678901234'; $std->nSeqEvento = 1; $std->dhEvento = '2025-09-23\T13:34:30-03:00'; $std->lote = null; $std->itens = $itens;

Parameters
$std : stdClass
$verAplic : string|null = null
Return values
string

sefazManifestacaoTransfCredIBS()

Evento: Manifestação sobre Pedido de Transferência de Crédito de IBS em Operações de Sucessão Evento a ser gerado pela sucessora em relação às notas fiscais de transferência de crédito de outra sucessora da mesma empresa sucedida para informar aceite da transferência de crédito de IBS.

public sefazManifestacaoTransfCredIBS(stdClass $std[, string|null $verAplic = null ]) : string

Modelo: NF-e modelo 55, Autor: Empresa sucessora, Código do Tipo de Evento: 212110

$std = new stdClass; $std->chNFe = '12345678901234567890123456789012345678901234'; $std->nSeqEvento = 1; $std->dhEvento = '2025-09-23\T13:34:30-03:00'; $std->lote = null; $std->itens = $itens;

Parameters
$std : stdClass
$verAplic : string|null = null
Return values
string

sefazManifestaLote()

Request the registration of the manifestation of recipient in batch

public sefazManifestaLote(stdClass $std[, DateTimeInterface|null $dhEvento = null ][, string|null $lote = null ]) : string
Parameters
$std : stdClass
$dhEvento : DateTimeInterface|null = null
$lote : string|null = null
Tags
throws
InvalidArgumentException
throws
RuntimeException
Return values
string

sefazRouboPerdaTransporteAdquirente()

Evento: Perecimento, perda, roubo ou furto durante o transporte contratado pelo adquirente Permitir ao adquirente informar quando uma aquisição for objeto de roubo, perda, furto ou perecimento.

public sefazRouboPerdaTransporteAdquirente(stdClass $std[, string|null $verAplic = null ]) : string

Observação: O evento atual está relacionado aos bens que foram objeto de perecimento, perda, roubo ou furto em trânsito, em fornecimentos com frete FOB. Modelo: NF-e modelo 55 Autor do Evento: Destinatário da NF-e em notas de saída Código do Tipo de Evento: 211124

Parameters
$std : stdClass
$verAplic : string|null = null
Tags
throws
Exception
Return values
string

sefazRouboPerdaTransporteFornecedor()

Evento: Perecimento, perda, roubo ou furto durante o transporte contratado pelo fornecedor Permitir ao fornecedor informar quando um bem for objeto de roubo, perda, furto ou perecimento antes da entrega, durante o transporte contratado pelo fornecedor.

public sefazRouboPerdaTransporteFornecedor(stdClass $std[, string|null $verAplic = null ]) : string

Observação: O evento atual está relacionado aos bens móveis materiais que foram objeto de perecimento, perda, roubo ou furto em trânsito, em fornecimentos com frete CIF. Modelo: NF-e modelo 55 Autor do Evento: emitente da NF-e em notas de saída. Código do Tipo de Evento: 112130

Parameters
$std : stdClass
$verAplic : string|null = null
Tags
throws
Exception
Return values
string

sefazSolApropCredPresumido()

Evento: Solicitação de Apropriação de crédito presumido Evento a ser gerado pelo adquirente, em relação às notas fiscais de aquisição de emissão de terceiros e que lhe gerem o dire ito à apropriação de crédito presumido.

public sefazSolApropCredPresumido(stdClass $std[, string|null $verAplic = null ]) : string

Modelo: NF-e modelo 55, Autor: Adquirente/Destinatário (quando os dois estiverem preenchidos, devem ser iguais) da nota fiscal, Código do Tipo de Evento: 211110

$itens = []; $itens[1] = [ 'item' => 1, 'vBC' => 100.00, 'gIBS' => [ 'cCredPres' => '01', 'pCredPres' => 2.5000, 'vCredPres' => 2.50 ], 'gCBS' => [ 'cCredPres' => '01', 'pCredPres' => 2.5000, 'vCredPres' => 2.50 ] ];

$std = new stdClass(); $std->chNFe = '12345678901234567890123456789012345678901234'; $std->nSeqEvento = 1; $std->itens = json_decode(json_encode($itens));

Parameters
$std : stdClass
$verAplic : string|null = null
Return values
string

sefazStatus()

Check services status SEFAZ/SVC If $uf is empty use normal check with contingency If $uf is NOT empty ignore contingency mode

public sefazStatus([string $uf = '' ][, int $tpAmb = null ][, bool $ignoreContingency = true ]) : string
Parameters
$uf : string = ''

initials of federation unit

$tpAmb : int = null
$ignoreContingency : bool = true
Return values
string

xml soap response

sefazStatusEpecNfce()

Check services status EPEC NFCE SEFAZ-SP only

public sefazStatusEpecNfce([string $uf = '' ][, int|null $tpAmb = null ][, bool $ignoreContingency = true ]) : string
Parameters
$uf : string = ''
$tpAmb : int|null = null
$ignoreContingency : bool = true
Return values
string

sefazValidate()

Checks the validity of an NFe, normally used for received NFe

public sefazValidate(string $nfe) : bool
Parameters
$nfe : string
Tags
throws
InvalidArgumentException
Return values
bool

setEnvironment()

Alter environment from "homologacao" to "producao" and vice-versa

public setEnvironment([int $tpAmb = 2 ]) : void
Parameters
$tpAmb : int = 2

setEnvironmentTimeZone()

Sets environment time zone

public setEnvironmentTimeZone(string $acronym) : void
Parameters
$acronym : string

(ou seja a sigla do estado)

setSignAlgorithm()

Set OPENSSL Algorithm using OPENSSL constants

public setSignAlgorithm([int $algorithm = OPENSSL_ALGO_SHA1 ]) : void
Parameters
$algorithm : int = OPENSSL_ALGO_SHA1

setVerAplic()

Set application version

public setVerAplic(string $ver) : void
Parameters
$ver : string

signNFe()

Sign NFe or NFCe

public signNFe(string $xml) : string
Parameters
$xml : string

NFe xml content

Tags
throws
RuntimeException
Return values
string

signed NFe xml

validKeyByUF()

Validate cUF from the key content and returns the state acronym

public validKeyByUF(string $chave) : string
Parameters
$chave : string
Tags
throws
InvalidArgumentException
Return values
string

version()

Set or get parameter layout version

public version([string $version = null ]) : string
Parameters
$version : string = null
Tags
throws
InvalidArgumentException
Return values
string

addQRCode()

Add QRCode Tag to signed XML from a NFCe

protected addQRCode(DOMDocument $dom) : string
Parameters
$dom : DOMDocument
Return values
string

checkContingencyForWebServices()

Verifies the existence of the service

protected checkContingencyForWebServices(string $service) : void
Parameters
$service : string

checkModel()

Somente aceitar modelo 55

protected checkModel(stdClass $std) : void
Parameters
$std : stdClass

checkModelFromXml()

Verify if xml model is equal as modelo property

protected checkModelFromXml(string $xml) : void
Parameters
$xml : string

checkSoap()

Verify if SOAP class is loaded, if not, force load SoapCurl

protected checkSoap() : mixed

correctNFeForContingencyMode()

Corrects NFe fields when in contingency mode

protected correctNFeForContingencyMode(string $xml) : string
Parameters
$xml : string

NFe xml content

Return values
string

getURIConsultaNFCe()

Get URI for search NFCe by key (chave)

protected getURIConsultaNFCe(string $uf, string $tpAmb) : string
Parameters
$uf : string

Abbreviation of the UF

$tpAmb : string

SEFAZ environment, 1-Production or 2-Homologation

Return values
string

getXmlUrlPath()

Recover path to xml database with list of soap services

protected getXmlUrlPath() : string
Return values
string

isValid()

Performs xml validation with its respective XSD structure definition document NOTE: if don't exists the XSD file will return true

protected isValid(string $version, string $body, string $method) : bool
Parameters
$version : string
$body : string
$method : string
Return values
bool

resolveVerAplic()

Resolve variavel verAplic

protected resolveVerAplic([string|null $verAplic = null ]) : string
Parameters
$verAplic : string|null = null
Return values
string

sendRequest()

Send request message to webservice

protected sendRequest(string $request[, array<string|int, mixed> $parameters = [] ]) : string
Parameters
$request : string
$parameters : array<string|int, mixed> = []
Return values
string

servico()

Assembles all the necessary parameters for soap communication

protected servico(string $service, string $uf, mixed $tpAmb[, bool $ignoreContingency = false ]) : void
Parameters
$service : string
$uf : string
$tpAmb : mixed
$ignoreContingency : bool = false

tagdetPag()

Cria detPag para Consciliação financeira

private tagdetPag(stdClass $pag) : false|string
Parameters
$pag : stdClass
Tags
throws
DOMException
Return values
false|string

tpEv()

Returns alias and description event from event code.

private tpEv(int $tpEvento) : stdClass
Parameters
$tpEvento : int
Tags
throws
RuntimeException
Return values
stdClass

        
On this page

Search results