Documentation

Tools
in package

Table of Contents

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
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
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
sendRequest()  : string
Send request message to webservice
servico()  : void
Assembles all the necessary parameters for soap communication

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

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

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

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

        
On this page

Search results