PHP code example of cristianomzn / danfse-nacional

1. Go to this page and download the library: Download cristianomzn/danfse-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/ */

    

cristianomzn / danfse-nacional example snippets


use DanfseNacional\DanfseGenerator;

$xml = file_get_contents('nfse_autorizada.xml');

$generator = new DanfseGenerator();
$pdf = $generator->generateFromXml($xml);

file_put_contents('danfse.pdf', $pdf);

$nfse = $generator->parseXml($xml);
echo $nfse->infNFSe->nNFSe;
echo $nfse->infNFSe->valores->vLiq;

$pdf = $generator->generatePdf($nfse);