PHP code example of leandro / nfe
1. Go to this page and download the library: Download leandro/nfe 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/ */
leandro / nfe example snippets
= __DIR__ . '/tests/utils/xmlTeste.xml';
$cert = new \PhpNFe\Tools\Certificado\Certificado();
$cert->carregarPfx(__DIR__ . 'seu_certificado.pfx', 'suaSenha');
$xml = file_get_contents($path);
$xml = $cert->assinarXML($xml, 'infNFe');
$nfe = new \PhpNFe\NFe\NFe($cert);
$b = $cert->ehValido();
$v = $nfe->validar($xml, '3.10');
$ret = $nfe->autorizar($xml);
$code = $ret->getCode();
$chave = $ret->getChNFe();
$retXml = $ret->getXML();
$message = $ret->getMessage();
echo 'foi';