1. Go to this page and download the library: Download sympla/double-deuce 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/ */
sympla / double-deuce example snippets
oubleDeuce\RemessaExport;
use DoubleDeuce\Itau;
use DoubleDeuce\Data;
// create person identities
$company = createCompany();
$favored1 = createFavored1();
$favored2 = createFavored2();
$segments = [];
//create each segment intance
$itauFileHeader = new Itau\ItauFileHeader($company);
$itauHeader = new Itau\ItauHeader($company, "LOTE PARA PAGAMENTO");
$segments[] = new Itau\ItauSegmentA($favored1, 2250.55);
$segments[] = new Itau\ItauSegmentB($favored1);
$segments[] = new Itau\ItauSegmentA($favored2, 127895.77, "ID 10 PAGAMENTO");
$segments[] = new Itau\ItauSegmentB($favored2);
//export data in right format
$export = new RemessaExport(
new Itau\ItauRemessa,
$itauFileHeader,
$itauHeader,
new Itau\ItauFooter,
new Itau\ItauFooterFile,
... array_values($segments)
);
$dataFile = $export->toString();
file_put_contents('remessa_itau.txt', $dataFile);
ympla\DoubleDeuce\Data;
//It is the same proccess to createCompany()
function createFavored() {
//create identity
$favoredIdenty = new Data\IdentifyDocument("Jhon Doe", "99028359028");
//create address
$favoredAddress = new Data\Address(
"Rua comum",
1245,
"São Bento",
"Betim",
"31200000",
"MG"
);
//create bank account
$favoredBank = new Data\BankAccount(70, 1, 69875, "9");
//create a Person
$favored = new Data\Person($favoredIdenty, $favoredAddress, $favoredBank);
}
use DoubleDeuce\Itau\ItauSegmentA;
use DoubleDeuce\Itau\ItauSegmentZ;
use DoubleDeuce\ReadReturn;
segments to read return
$readReturn = new ReadReturn($file, new ItauSegmentA(), new ItauSegmentZ());
//can read one or many segments
$readReturn2 = new ReadReturn($file, new ItauSegmentA());
//bring all segments in array format
var_dump($readReturn->getReturnData());
var_dump($readReturn2->getReturnData());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.