PHPackages                             diegomoura/laravel-boleto - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. diegomoura/laravel-boleto

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

diegomoura/laravel-boleto
=========================

Biblioteca de boletos para o laravel

2.1(7y ago)4753↓50%1MITPHPPHP &gt;=5.5.0

Since Feb 2Pushed 7y ago1 watchersCompare

[ Source](https://github.com/diegomoura/laravel-boleto)[ Packagist](https://packagist.org/packages/diegomoura/laravel-boleto)[ Docs](https://github.com/diegomoura/laravel-boleto)[ RSS](/packages/diegomoura-laravel-boleto/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (20)Used By (0)

[![Packagist](https://camo.githubusercontent.com/37b087aeaa498c1f16e37512261503fcd8f5d62504453c961899d67d91b33842/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f446965676f6d6f7572612f6c61726176656c2d626f6c65746f2e7376673f7374796c653d666c61742d737175617265)](https://github.com/Diegomoura/laravel-boleto)[![Packagist](https://camo.githubusercontent.com/0d79c401ae14fc80c015d25a064160390af28cef848c726451715c8a1a85294f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f446965676f6d6f7572612f6c61726176656c2d626f6c65746f2e7376673f7374796c653d666c61742d737175617265)](https://github.com/Diegomoura/laravel-boleto)[![Packagist](https://camo.githubusercontent.com/fd0ffaa7e8a4d6418becb2729ea465eac50f42b35726ea2cc18dc192a5f55748/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f446965676f6d6f7572612f6c61726176656c2d626f6c65746f2e7376673f7374796c653d666c61742d737175617265)](https://github.com/Diegomoura/laravel-boleto)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/6fe901b7b2564e1f5c0a591b3c9ae013dfcee0c91257382fbfafe78fd51978ca/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f446965676f6d6f7572612f6c61726176656c2d626f6c65746f2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Diegomoura/laravel-boleto/?branch=master)[![Build Status](https://camo.githubusercontent.com/bb87def714efcbef5f8ef0de1f14745b2af789a8e4b1453c529f8dc598de3815/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f446965676f6d6f7572612f6c61726176656c2d626f6c65746f2f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Diegomoura/laravel-boleto/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/6fe901b7b2564e1f5c0a591b3c9ae013dfcee0c91257382fbfafe78fd51978ca/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f446965676f6d6f7572612f6c61726176656c2d626f6c65746f2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Diegomoura/laravel-boleto/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/59464fd6de86b748b156bde4f90f8d425b13a2b93991c617cfd6f11a5437a0ce/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f446965676f6d6f7572612f6c61726176656c2d626f6c65746f2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Diegomoura/laravel-boleto/?branch=master)[![Build Status](https://camo.githubusercontent.com/556bdc9c46f78d5fc4018973f64235d143146a3b74c9349c19e36cd349a74255/68747470733a2f2f7472617669732d63692e6f72672f446965676f6d6f7572612f6c61726176656c2d626f6c65746f2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Diegomoura/laravel-boleto)[![GitHub forks](https://camo.githubusercontent.com/6a7215ac38e7c8c2c603218fde8da9105791078c96959b5c649713f6724bce18/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f446965676f6d6f7572612f6c61726176656c2d626f6c65746f2e7376673f7374796c653d736f6369616c266c6162656c3d466f726b)](https://github.com/Diegomoura/laravel-boleto)

Laravel Boleto
==============

[](#laravel-boleto)

Pacote para gerar boletos, remessas e leitura de retorno.

Para dúvidas ou sugestões utilize o nosso grupo de discussão
------------------------------------------------------------

[](#para-dúvidas-ou-sugestões-utilize-o-nosso-grupo-de-discussão)

Requerimentos
-------------

[](#requerimentos)

- [PHP Extensão Intl](http://php.net/manual/pt_BR/book.intl.php)

Links
-----

[](#links)

- [Documentação da API](http://Diegomoura.github.io/laravel-boleto/)
- [Grupo de Discussão](https://groups.google.com/d/forum/laravel-boleto)
- [Grupo no Telegram](https://t.me/laravelBoleto)

Bancos suportados
-----------------

[](#bancos-suportados)

BancoBoletoRemessa 400Remessa 240Retorno 400Retorno 240Banco do Brasil✅✅✅Bancoob (Sicoob)✅ \*✅✅ \*Banrisul✅✅✅Bradesco✅✅✅Caixa✅✅✅Hsbc✅✅✅Itau✅✅✅Santander✅✅✅✅✅Sicredi✅✅✅ \***\* necessita de homologação**

Instalação
----------

[](#instalação)

Via composer:

composer require Diegomoura/laravel-boleto

Ou adicione manualmente ao seu composer.json:

"Diegomoura/laravel-boleto": "dev-master"

Gerar boleto
------------

[](#gerar-boleto)

### Criando o beneficiário ou pagador

[](#criando-o-beneficiário-ou-pagador)

```
$beneficiario = new \Diegomoura\LaravelBoleto\Pessoa([
    'nome' => 'ACME',
    'endereco' => 'Rua um, 123',
    'cep' => '99999-999',
    'uf' => 'UF',
    'cidade' => 'CIDADE',
    'documento' => '99.999.999/9999-99',
]);

$pagador = new \Diegomoura\LaravelBoleto\Pessoa([
    'nome' => 'Cliente',
    'endereco' => 'Rua um, 123',
    'bairro' => 'Bairro',
    'cep' => '99999-999',
    'uf' => 'UF',
    'cidade' => 'CIDADE',
    'documento' => '999.999.999-99',
]);
```

### Criando o objeto boleto

[](#criando-o-objeto-boleto)

#### Campos númericos e suas funções

[](#campos-númericos-e-suas-funções)

- **numero**: campo numérico utilizado para a criação do nosso numero. (identificação do título no banco)\*
- **numeroControle**: campo de livre utilização. até 25 caracteres. *(identificação do título na empresa)*
- **numeroDocumento**: campo utilizado para informar ao que o documento se referente *(duplicata, nf, np, ns, etc...)*

```
$boletoArray = [
	'logo' => 'path/para/o/logo', // Logo da empresa
	'dataVencimento' => new \Carbon\Carbon('1790-01-01'),
	'valor' => 100.00,
	'multa' => 10.00, // porcento
	'juros' => 2.00, // porcento ao mes
	'juros_apos' =>  1, // juros e multa após
	'diasProtesto' => false, // protestar após, se for necessário
	'numero' => 1,
	'numeroDocumento' => 1,
	'pagador' => $pagador, // Objeto PessoaContract
	'beneficiario' => $beneficiario, // Objeto PessoaContract
	'agencia' => 9999, // BB, Bradesco, CEF, HSBC, Itáu
	'agenciaDv' => 9, // se possuir
	'conta' => 99999, // BB, Bradesco, CEF, HSBC, Itáu, Santander
	'contaDv' => 9, // Bradesco, HSBC, Itáu
	'carteira' => 99, // BB, Bradesco, CEF, HSBC, Itáu, Santander
	'convenio' => 9999999, // BB
	'variacaoCarteira' => 99, // BB
	'range' => 99999, // HSBC
	'codigoCliente' => 99999, // Bradesco, CEF, Santander
	'ios' => 0, // Santander
	'descricaoDemonstrativo' => ['msg1', 'msg2', 'msg3'], // máximo de 5
	'instrucoes' =>  ['inst1', 'inst2'], // máximo de 5
	'aceite' => 1,
	'especieDoc' => 'DM',
];

$boleto = new \Diegomoura\LaravelBoleto\Boleto\Banco\Bb($boletoArray);
```

### Gerando o boleto

[](#gerando-o-boleto)

**Gerando o boleto a partir da instância do objeto (somente um boleto)**

```
$boleto->renderPDF();
// ou
$boleto->renderHTML();

// Os dois métodos aceita como parâmetro 2 boleano.
// 1º Se True após renderizado irá mostrar a janela de impressão. O Valor default é false.
// 2º Se False irá esconder as instruções de impressão. O valor default é true
$boleto->renderPDF(true, false); // mostra a janela de impressão e esconde as instruções de impressão
```

```
/*
 * O comportamento padrão para os métodos renderPDF e renderHTM é retornar uma string pura.
 * Para gerar um retorno no controller do laravel utilize da seguinte forma:
 */

// PDF
return response($boleto->renderPDF(), 200, [
    'Content-Type' => 'application/pdf',
    'Content-Disposition' => 'inline; boleto.pdf',
]);

// HTML
return response($boleto->renderHTML());
```

**Gerando boleto a partir da instância do render**

```
// Gerar em PDF
$pdf = new Diegomoura\LaravelBoleto\Boleto\Render\Pdf();

$pdf->addBoleto($boleto);
// Ou para adicionar um array de boletos
$pdf->addBoletos($boletos);

// Quando não informado parâmetros ele se comportará como Pdf::OUTPUT_STANDARD, enviando o buffer do pdf com os headers apropriados.
$pdf->gerarBoleto();

// Para mostrar a janela de impressão no load do PDF
$pdf->showPrint();

// Para remover as intruções de impressão
$pdf->hideInstrucoes();

// O método gerarBoleto da classe PDF aceita como parâmetro:
//	1º destino: constante com os destinos disponíveis. Ex: Pdf::OUTPUT_SAVE.
//	2º path: caminho absoluto para salvar o pdf quando destino for Pdf::OUTPUT_SAVE.
//Ex:
$pdf->gerarBoleto(Pdf::OUTPUT_SAVE, storage_path('app/boletos/meu_boleto.pdf')); // salva o boleto na pasta.
$pdf_inline = $pdf->gerarBoleto(Pdf::OUTPUT_STRING); // retorna o boleto em formato string.
$pdf->gerarBoleto(Pdf::OUTPUT_DOWNLOAD); // força o download pelo navegador.

// Gerar em HTML
$html = new Diegomoura\LaravelBoleto\Boleto\Render\Html();
$html->addBoleto($boleto);
// Ou para adicionar um array de boletos
$html->addBoletos($boletos);

// Para mostrar a janela de impressão no load da página
$html->showPrint();

// Para remover as intruções de impressão
$html->hideInstrucoes();

$html->gerarBoleto();
```

Gerar remessa
-------------

[](#gerar-remessa)

```
$remessaArray = [
	'agencia' => 9999,
	'agenciaDv' => 9, // se possuir
	'conta' => 99999,
	'contaDv' => 9, // se possuir
	'carteira' => 99,
	'convenio' => 9999999, // se possuir
	'range' => 99999, // se possuir
	'codigoCliente' => 99999, // se possuir
	'variacaoCarteira' => 99, // se possuir
	'beneficiario' => $beneficiario,
];

$remessa = new \Diegomoura\LaravelBoleto\Cnab\Remessa\Cnab400\Banco\Bb($remessaArray);

// Adicionar um boleto.
$remessa->addBoleto($boleto);

// Ou para adicionar um array de boletos
$boletos = [];
$boletos[] = $boleto1;
$boletos[] = $boleto2;
$boletos[] = $boleto3;
$remessa->addBoletos($boletos);

echo $remessa->gerar();
```

Tratar retorno
--------------

[](#tratar-retorno)

```
$retorno = \Diegomoura\LaravelBoleto\Cnab\Retorno\Factory::make('full_path_arquivo_retorno');
$retorno->processar();
echo $retorno->getBancoNome();

// Retorno implementa \SeekableIterator sendo assim podemos utilizar o foreach da seguinte forma:
foreach($retorno as $registro) {
	var_dump($registro->getDados());
}

// Ou também podemos:
$detalheCollection = $retorno->getDetalhes();
foreach($detalheCollection as $detalhe) {
	var_dump($detalhe->getDados());
}

// Ou até mesmo do jeito laravel
$detalheCollection->each(function ($detalhe, $index) {
    var_dump($detalhe->getDados())
});
```

**Métodos disponíveis:**

```
$retorno->getDetalhes();

$retorno->getHeader();

$retorno->getTrailer();
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 76.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~62 days

Recently: every ~161 days

Total

18

Last Release

2699d ago

Major Versions

0.5 → 1.02017-03-08

1.9 → 2.02017-05-25

PHP version history (2 changes)0.1PHP &gt;=5.3.0

0.5PHP &gt;=5.5.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/e6dcb1ea319685bd74450e59f28cbbf6f93d268d403cbe40b2c990c80d554a70?d=identicon)[diegomoura](/maintainers/diegomoura)

---

Top Contributors

[![eduardokum](https://avatars.githubusercontent.com/u/2566340?v=4)](https://github.com/eduardokum "eduardokum (226 commits)")[![devguar](https://avatars.githubusercontent.com/u/6453377?v=4)](https://github.com/devguar "devguar (19 commits)")[![diegomoura](https://avatars.githubusercontent.com/u/1993932?v=4)](https://github.com/diegomoura "diegomoura (17 commits)")[![leonardopinho](https://avatars.githubusercontent.com/u/956680?v=4)](https://github.com/leonardopinho "leonardopinho (14 commits)")[![mprandot](https://avatars.githubusercontent.com/u/14298396?v=4)](https://github.com/mprandot "mprandot (5 commits)")[![rafwell](https://avatars.githubusercontent.com/u/2893078?v=4)](https://github.com/rafwell "rafwell (3 commits)")[![renatoagomes](https://avatars.githubusercontent.com/u/9811888?v=4)](https://github.com/renatoagomes "renatoagomes (2 commits)")[![edigomes](https://avatars.githubusercontent.com/u/9788003?v=4)](https://github.com/edigomes "edigomes (2 commits)")[![danielAlbuquerque](https://avatars.githubusercontent.com/u/6063722?v=4)](https://github.com/danielAlbuquerque "danielAlbuquerque (2 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")[![dann95](https://avatars.githubusercontent.com/u/9970959?v=4)](https://github.com/dann95 "dann95 (1 commits)")[![dbemfica](https://avatars.githubusercontent.com/u/13237440?v=4)](https://github.com/dbemfica "dbemfica (1 commits)")[![edolfuchs](https://avatars.githubusercontent.com/u/12100777?v=4)](https://github.com/edolfuchs "edolfuchs (1 commits)")[![eduardokum-curso](https://avatars.githubusercontent.com/u/17689407?v=4)](https://github.com/eduardokum-curso "eduardokum-curso (1 commits)")[![emtudo](https://avatars.githubusercontent.com/u/191396?v=4)](https://github.com/emtudo "emtudo (1 commits)")[![ricardobarantini](https://avatars.githubusercontent.com/u/1111361?v=4)](https://github.com/ricardobarantini "ricardobarantini (1 commits)")

---

Tags

laravel-boletodiegomoura

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/diegomoura-laravel-boleto/health.svg)

```
[![Health](https://phpackages.com/badges/diegomoura-laravel-boleto/health.svg)](https://phpackages.com/packages/diegomoura-laravel-boleto)
```

###  Alternatives

[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[erlandmuchasaj/laravel-gzip

Gzip your responses.

40129.3k2](/packages/erlandmuchasaj-laravel-gzip)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
