PHP code example of masyasmv / aton-statement-parser
1. Go to this page and download the library: Download masyasmv/aton-statement-parser 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/ */
masyasmv / aton-statement-parser example snippets
use MasyaSmv\AtonStatementParser\AtonStatementParser;
$report = AtonStatementParser::fromFile('/path/to/report.xml');
// Доступ к секциям (универсально)
$trades = $report->section('Trades')->rows(); // RowCollection
$money = $report->section('MoneyInOut')->rows(); // RowCollection
// DTO-уровень для типовых сценариев
$commonData = $report->commonData(); // ?CommonData
$tradeDtos = $report->trades(); // TradeCollection
$moneyDtos = $report->moneyInOut(); // MoneyOperationCollection
$moneyState = $report->moneyOnDate(); // MoneyBalanceCollection
$stockState = $report->stockOnDate(); // StockBalanceCollection
$fxDtos = $report->moneyConvert(); // MoneyConvertCollection
$stockDtos = $report->stockInOut(); // StockTransferCollection
$payoffDtos = $report->stockPayingOff(); // StockPayingOffCollection
$corpInDtos = $report->corporateActionsIn(); // CorporateActionCollection
$corpOutDtos = $report->corporateActionsOut(); // CorporateActionCollection
// Поиск по OperID
$row = $report->findOperId('567890123'); // Row|null
// Список всех OperID (для сверки)
$ids = $report->operIds(); // OperIdCollection
// Диагностика неизвестных структур и ключей
$diagnostics = $report->diagnostics(); // DiagnosticCollection
$hasWarnings = $report->hasDiagnostics(); // bool
// Удобные геттеры атрибутов
$type = $report->section('Trades')->rows()->get(0)->getString('TradeType');
$date = $report->section('Trades')->rows()->get(0)->getDate('OperDateSort'); // DateTimeImmutable|null