1. Go to this page and download the library: Download webwingscz/bank-statements 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/ */
webwingscz / bank-statements example snippets
use Webwings\BankStatements\Abo\AboDialect;
use Webwings\BankStatements\Abo\AboParser;
$parser = new AboParser(AboDialect::fio());
foreach ($parser->parseFile('statement.gpc') as $statement) {
echo $statement->accountNumber?->toString(), "\n"; // 8310192897/2010
echo $statement->closingBalance->toDecimalString(), "\n";
foreach ($statement as $transaction) {
printf(
"%s %10s %-20s VS %s\n",
$transaction->date()?->format('Y-m-d'),
$transaction->amount->toDecimalString(), // "-24.20"
$transaction->payerOrPayeeName() ?? '',
$transaction->variableSymbol ?? '-',
);
}
}
new AboParser(AboDialect::forBankCode('0800')); // Česká spořitelna
new AboParser(AboDialect::fio()); // 2010
new AboParser(AboDialect::csob()); // 0300
new AboParser(AboDialect::standard()); // anything without a known deviation
use Webwings\BankStatements\Wise\WiseFileName;
$name = WiseFileName::tryParse($path); // balanceId "3807780", currency "EUR", from, to
$parser = new WiseParser(accountNumber: $accountsByBalanceId[$name->balanceId] ?? null);
use Webwings\BankStatements\Wise\WiseDetailsType;
use Webwings\BankStatements\Wise\WiseTransactionDetail;
if ($transaction->detail instanceof WiseTransactionDetail) {
$transaction->detail->exchangeRate; // "20.96460", a string on purpose
$transaction->detail->exchangeToAmount?->toDecimalString(); // "150000.00"
$transaction->detail->bookedAt?->format('Y-m-d H:i:s.v'); // the time of day, too
$transaction->detail->runningBalance?->toDecimalString();
$transaction->detail->cardLastFourDigits;
$transaction->detail->detailsType === WiseDetailsType::Conversion;
}
$transaction->detail->isFee(); // true for the FEE- item
$transaction->detail->feeOf(); // "TRANSFER-2185636734"
$transaction->detail->fees; // on the charged item: the 22.16 it reports
new WiseParser(accountNumber: $account, strict: true);
use Webwings\BankStatements\Camt\Camt053Parser;
$parser = new Camt053Parser();
foreach ($parser->parseFile('statement.xml') as $statement) {
echo $statement->accountNumber?->toString(), "\n"; // 2600123456/0300
echo $statement->identification, "\n"; // Stmt/Id
echo $statement->closingBalance->toDecimalString(), "\n";
foreach ($statement as $transaction) {
printf(
"%s %10s %-20s VS %s\n",
$transaction->date()?->format('Y-m-d'),
$transaction->amount->toDecimalString(),
$transaction->counterPartyName ?? '',
$transaction->variableSymbol ?? '-',
);
}
}
use Webwings\BankStatements\Camt\CamtTransactionDetail;
if ($transaction->detail instanceof CamtTransactionDetail && $transaction->detail->isBatch()) {
echo $transaction->detail->transactionDetailsCount; // 3
echo $transaction->detail->batchPaymentInformationId; // PAYROLL-2026-07
}
use Webwings\BankStatements\Mt940\Mt940Parser;
$parser = new Mt940Parser(bankCode: '0800', clientName: 'Vzor s.r.o.');
foreach ($parser->parseFile('AUSZUG.TXT') as $statement) {
echo $statement->identification, "\n"; // field :20:
echo $statement->accountNumber?->toString(), "\n"; // 2600123456/0800
echo $statement->closingBalance->toDecimalString(), "\n";
}
new Mt940Parser(strict: true);
// Force a specific mechanism, e.g. to reproduce a production environment
new AboParser(AboDialect::fio(), decoder: new TextDecoder(converter: TextConverter::BuiltIn));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.