NFePHPaulista are two classes for NF-e Paulista Webservices communication
Switch branches/tags
Nothing to show
Latest commit a7282b1 May 3, 2014 Reinaldo Nolasco Sanches Update and rename README to


I don't work with PHP since 2012 and have no more contact with the system that I created this classes for since 2011. Please, if you have improvements for this project or updates, fork this project and help others with your updates :D I can't accept pull request because I have no way to test.


Simple doc for NFePHPaulista

NFePHPaulista are two classes for NF-e Paulista Webservices communication. Those classes are both in MIT License.

FAQ NFe Paulista: Doc Webservices: IBGE City Codes:

NFe class make Webservices communication. You need to set values of come variables

$providerFederalTaxNumber = ''; // Your CNPJ
$providerTaxpayerRegister = ''; // Your CCM
$passphrase = ''; // Cert passphrase
$pkcs12  = '/patch/for/nfe/certificates/nfe.pfx';
$certDir = '/patch/for/nfe/certificates'; // Dir for .pem certs

NFeRPS class is a Value Object. You can make a __construct or populate like a stdClass

Simple example for NFeRPS Array population

  $rpsArray = array();
  $totalServicesValue = 0;
  foreach ( $yourInfoArray as $invoice ) {
    $nfeRPS = new NFeRPS();
    /* ContractorRPS is aggregate on NFeRPS */
    /* $nfeRPS->$contractorRPS = new ContractorRPS(); */
    /* Your logic for $nfeRPS population. You can make a __construct for NFeRPS */
    $rpsArray[] = $nfeRPS;
    $totalServicesValue += $invoice->getValor();

Webservices communication

  $nfe = new NFe();

  /* Use sendRPSBatchTest for tests sendRPSBatch for production */
  $result = $nfe->sendRPSBatchTest( array( 'start' => date( 'Y-m-d' ), 'end' => date( 'Y-m-d' ) ),
                                    array( 'servives' => $totalServicesValue, 'deductions' => 0 ),
                                    $rpsArray );

You can use 'textFile' method to create batch file for site upload instead webservice communication:

  $result = $nfe->textFile( array( 'start' => date( 'U' ), 'end' => date( 'U' ) ),
                            array( 'servives' => $totalServicesValue, 'deductions' => 0 ),
                            $rpsArray );

Webservices and NFe class methods

Webservice method NFe class method
EnvioRPSResponse EnvioRPS() sendRPS
EnvioLoteRPSResponse EnvioLoteRPS() sendRPSBatch
TesteEnvioLoteRPSResponse TesteEnvioLoteRPS() sendRPSBatchTest
CancelamentoNFeResponse CancelamentoNFe() cancelNFe
ConsultaNFeResponse ConsultaNFe() queryNFe
ConsultaNFeRecebidasResponse ConsultaNFeRecebidas() queryNFeReceived
ConsultaNFeEmitidasResponse ConsultaNFeEmitidas() queryNFeIssued
ConsultaLoteResponse ConsultaLote() queryBatch
ConsultaInformacoesLoteResponse ConsultaInformacoesLote() queryBatchInfo
ConsultaCNPJResponse ConsultaCNPJ() queryCNPJ