PHP code example of dermevaldo / pagamento_cnab_240_sicredi
1. Go to this page and download the library: Download dermevaldo/pagamento_cnab_240_sicredi 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/ */
dermevaldo / pagamento_cnab_240_sicredi example snippets
$retorno = \Murilo\Pagamento\Cnab\Retorno\Factory::make('/caminho/para/arquivo.RET');
$retorno->processar();
echo $retorno->getBancoNome();
// Retorno implementa \SeekableIterator, sendo assim, podemos utilizar o foreach da seguinte forma:
foreach($retorno as $registro) {
var_dump($registro->toArray());
}
// Ou também podemos:
$detalheCollection = $retorno->getDetalhes();
foreach($detalheCollection as $detalhe) {
var_dump($detalhe->toArray());
}
// Ou até mesmo do jeito laravel
$detalheCollection->each(function ($detalhe, $index) {
var_dump($detalhe->toArray())
});