PHP code example of guzinski / cnab_php

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

    

guzinski / cnab_php example snippets


$cnabFactory = new Cnab\Factory();
$arquivo = $cnabFactory->createRetorno('AQUI VAI O CAMINHO DO ARQUIVO DE RETORNO, EX: RET1010.RET');
$detalhes = $arquivo->listDetalhes();
foreach($detalhes as $detalhe) {
    if($detalhe->getValorRecebido() > 0) {
        $nossoNumero   = $detalhe->getNossoNumero();
        $valorRecebido = $detalhe->getValorRecebido();
        $dataPagamento = $detalhe->getDataOcorrencia();
        $carteira      = $detalhe->getCarteira();
        // você já tem as informações, pode dar baixa no boleto aqui
    }
}

"andersondanilo/cnab_php": "1.3.*"