You are on page 1of 2

30/03/2015 reinaldons/NFePHPaulista 

· GitHub

 This repository Search Explore Features Enterprise Blog Sign up   Sign in

 reinaldons / NFePHPaulista  Watch 4  Star 20  Fork 7

NFePHPaulista are two classes for NF­e Paulista Webservices communication
  Code
 5 commits  1 branch  0 releases  1 contributor
  Issues
  branch: master  NFePHPaulista /  
  Pull requests
Update and rename README to README.md

 reinaldons authored on 3 May 2014 latest commit a7282b1add    Pulse

 LICENSE First commit 5 years ago


 Graphs
 NFe.class.php Using internal PHP SoapClient for connection. 5 years ago

 NFeRPS.class.php First commit 5 years ago HTTPS clone URL


https://github.com/reinaldons/NFePHPa
 README.md Update and rename README to README.md 11 months ago
You can clone with HTTPS or
Subversion. 
 README.md
 Clone in Desktop

ATTENTION!  Download ZIP

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.

Thanks!

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

Help make GitHub better. 
FAQ NFe Paulista: http://www.prefeitura.sp.gov.br/portal/nfe/perguntas_mais_frequentes/index.php?
Our engineers and designers are interested in 
content=faq Doc Webservices: http://ww2.prefeitura.sp.gov.br/nfe/files/NFe­Web­Service­v2­2.pdf
how you manage projects.
IBGE City Codes: http://www.ibge.gov.br/concla/cod_area/cod_area.php
http://www.ibge.gov.br/concla/cod_area/tabela_municipios.xls
1­minute survey 

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 ) {

https://github.com/reinaldons/NFePHPaulista 1/2
30/03/2015 reinaldons/NFePHPaulista · GitHub
    $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

© 2015 GitHub, Inc.  Terms  Privacy  Security  Contact  Status  API  Training  Shop  Blog  About

https://github.com/reinaldons/NFePHPaulista 2/2

You might also like