PHP code example of webmaniabr / mdfe

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

    

webmaniabr / mdfe example snippets


composer 



\Webmaniabr\Mdfe\Api\Connection::getInstance()->setBearerToken('SEU_TOKEN_AUTENTICACAO');
$MDFe = new \Webmaniabr\Mdfe\Models\MDFe();
$MDFe->emitente = \Webmaniabr\Mdfe\Enums\TipoEmitente::PRESTADOR_DE_SERVICO;
$MDFe->transportador = \Webmaniabr\Mdfe\Enums\TipoTransportador::TAC;
$MDFe->ufCarregamento = \Webmaniabr\Mdfe\Enums\UF::GOIAS;
$MDFe->ufDescarregamento = \Webmaniabr\Mdfe\Enums\UF::PARANA;
$MDFe->valorCarga = 500;
...
echo $MDFe->emitir()->getMessage();