PHP code example of alves / laravel-boleto

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

    

alves / laravel-boleto example snippets




use Alves\LaravelBoleto\Boleto\Banco\Bradesco;
use Alves\LaravelBoleto\Pessoa;

$beneficiario = new Pessoa([
    'nome'      => 'ACME LTDA',
    'documento' => '12.345.678/0001-90',
    'endereco'  => 'Rua 1',
    'bairro'    => 'Centro',
    'cep'       => '99999-999',
    'uf'        => 'SP',
    'cidade'    => 'São Paulo',
]);

$pagador = new Pessoa([
    'nome'      => 'Cliente Teste',
    'documento' => '123.456.789-09',
    'endereco'  => 'Rua 2',
    'bairro'    => 'Centro',
    'cep'       => '99999-999',
    'uf'        => 'SP',
    'cidade'    => 'São Paulo',
]);

$boleto = new Bradesco([
    'logo'            => realpath(__DIR__ . '/logos/237.png'),
    'dataVencimento'  => new DateTime(),
    'valor'           => 100.00,
    'multa'           => false,
    'juros'           => false,
    'numero'          => 1,
    'numeroDocumento' => 1,
    'pagador'         => $pagador,
    'beneficiario'    => $beneficiario,
    'agencia'         => 1111,
    'conta'           => 99999,
    'carteira'        => 9,
]);