PHP code example of juizmill / boleto-zend-framework

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

    

juizmill / boleto-zend-framework example snippets


    public function boletoAction()
    {
        $pagador = [
            'nome' => 'Cliente',
            'endereco' => 'Rua um, 123',
            'bairro' => 'Bairro',
            'cep' => '99999-999',
            'uf' => 'UF',
            'cidade' => 'CIDADE',
            'documento' => '999.999.999-99',
        ];

        $dadosBoleto = [
            'dataVencimento' => new \Carbon\Carbon('1790-01-01'),
            'valor' => 100.00,
            'numero' => 1,
            'numeroDocumento' => 1,
            'codigoCliente' => 99999,
        ];

        $boleto = $this->boletoService->setDadosBoleto($dadosBoleto)
            ->setDadosPagador($pagador)
            ->getBoleto(BoletoServiceInterface::CAIXA);

        $response = new Response();
        $header = new Headers();
        $header->addHeaders([
            'Content-Type' => 'application/pdf',
            'Content-Disposition' => 'inline; boleto.pdf',
        ]);
        $response->setHeaders($header);
        $response->setStatusCode(200);
        $response->setContent($boleto->renderPDF());

        return $response;
    }