A zero dependencies PHP Parser for CFONB statements
Supports CFONB 120/240 format
The preferred method of installation is via Composer. Run the following
command to install the package and add it as a requirement to your project's
composer.json
:
composer require silarhi/cfonb-parser
<?php
use Silarhi\Cfonb\Cfonb120Reader;
$reader = new Cfonb120Reader();
//Gets all statements day by day
foreach($reader->parse('My Content') as $statement) {
if ($statement->hasOldBalance()) {
echo sprintf("Old balance : %f\n", $statement->getOldBalance()->getAmount());
}
foreach($statement->getOperations() as $operation) {
//Gets all statement operations
}
if ($statement->hasNewBalance()) {
echo sprintf("New balance : %f\n", $statement->getNewBalance()->getAmount());
}
}
<?php
use Silarhi\Cfonb\Cfonb240Reader;
$reader = new Cfonb240Reader();
foreach($reader->parse('My Content') as $transfer) {
assert($transfer instanceof \Silarhi\Cfonb\Banking\Transfer);
}
<?php
use Silarhi\Cfonb\CfonbReader;
$reader = new CfonbReader();
foreach($reader->parseCfonb120('My Content') as $statement) {
assert($statement instanceof \Silarhi\Cfonb\Banking\Statement);
}
foreach($reader->parseCfonb240('My Content') as $transfer) {
assert($transfer instanceof \Silarhi\Cfonb\Banking\Transfer);
}