PHP code example of umbrella / retorno-boleto

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

    

umbrella / retorno-boleto example snippets




use Umbrella\Ya\RetornoBoleto\ProcessFactory;
use Umbrella\Ya\RetornoBoleto\ProcessHandler;

// Utilizamos a factory para construir o objeto correto para um determinado arquivo de retorno
$cnab = ProcessFactory::getRetorno('arquivo-retorno.ret');

// Passamos o objeto contruido para o handler
$processor = new ProcessHandler($cnab);
  
// Processamos o arquivo. Isso retornará um objeto parseado com todas as propriedades do arquvio.
$retorno = $processor->processar();

use Umbrella\Ya\RetornoBoleto\Event\OnDetailRegisterEvent;
use Umbrella\Ya\RetornoBoleto\ProcessFactory;
use Umbrella\Ya\RetornoBoleto\ProcessHandler;
use Umbrella\Ya\RetornoBoleto\RetornoEvents;

// Passamos o objeto contruido para o handler
$processor = new ProcessHandler($cnab);

$processor->getDispatcher()->addListener(RetornoEvents::ON_DETAIL_REGISTER,
                                         function(OnDetailRegisterEvent $event) use($self, &$count) {
    echo $event->getLineNumber() . PHP_EOL;
});
        
bash
# Install Composer
curl -sS https://getcomposer.org/installer | php

# Adicionando YA Retorno Boleto como dependencia
php composer.phar