PHP code example of marcelabeh / emissor-nfse-nacional

1. Go to this page and download the library: Download marcelabeh/emissor-nfse-nacional library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

marcelabeh / emissor-nfse-nacional example snippets


use MarcelaBeh\EmissorNfseNacional\Presentation\Facade\NfseNacionalFacade;
use MarcelaBeh\EmissorNfseNacional\Presentation\Factory\ConfigFactory;
use NFePHP\Common\Certificate;

// 1. Carregar certificado
$certificado = Certificate::readPfx(file_get_contents($caminhoCertificado), $senha);

// 2. Criar configuração
$config = ConfigFactory::createHomologacao('codigo-ibge-municipio');

// 3. Criar facade (aceita Configuration|array — sem cast)
$nfse = NfseNacionalFacade::create($config, $certificado);

// 4. Emitir DPS
$response = $nfse->emitirDps($dpsRequest);

$nfse->consultarPorChave('CHAVE', false);

$response->mensagem;  // primeiro erro, ex.: "E0617 - Não é permitido informar alíquota..."
$response->erros;     // lista completa: [['codigo' => 'E0617', 'descricao' => '...'], ...]
$response->dados;     // payload cru da SEFIN