2017 © Pedro Peláez
 

library statement

Read, parse and match bank statements

image

sebastianwalker/statement

Read, parse and match bank statements

  • Monday, April 9, 2018
  • by hiwye
  • Repository
  • 1 Watchers
  • 1 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

statement

A PHP library to read, parse and match bank account exports., (*1)

You can use statement to, (*2)

  • Parse CSV bank statements into usable PHP classes
  • Guess column mappings
  • Match domain objects with transaction descriptions (e.g. for payment processing)

Installation

composer require sebastianwalker/statement

Transactions

// Transaction ($amount, $description, $payer, $iban, $date)
$transaction = new \SebastianWalker\Statement\Transaction(12.34, "Desc", "John Doe", "DE...00", new \Carbon\Carbon("2018-02-12"));

$transaction->getAmount(); // float

$transaction->getDescription(); // string

$transaction->getPayer(); // string

$transaction->getIban(); // string | null

$transaction->getDate(); // Carbon instance: http://carbon.nesbot.com/docs/

Importing statements

From CSV

// FromCsv($filename, $delimiter, $known_mapping, $known_offset)
$importer = new \SebastianWalker\Statement\Importers\FromCsv("file.csv");

// Get the imported transactions
$transactions = $importer->getTransactions();

// Get the mapping used (guessed + known_mapping)
$mapping = $importer->getMapping();
/*[
  "amount"=>"Amount",
  "description"=>"Description",
  "payer"=>"Payer/Payee",
  "iban"=>"IBAN",
  "date"=>"Valuta Date"
]*/

// Get the column titles usable for mapping as an array
$columns = $importer->getColumns();

From Array

// FromArray($transactions)
$importer = new \SebastianWalker\Statement\Importers\FromArray([/*Array of Transactions*/]);

// Get the imported transactions
$transactions = $importer->getTransactions();

Matching Transactions with Domain Objects

Matching by Prefix

Ask your payers to include a transaction description of {Your Prefix}{Your Object Identifier} when sending the funds.
Example Description: PFIX-12345678, (*3)

$matcher = new \SebastianWalker\Statement\Matchers\PrefixMatcher("PFIX-");

// Get all matching entities that are referenced in a given transaction
$matches = $matcher->getEntities($transaction);

The prefix matcher looks for occurrences in the transaction's description of the given prefix and returns the appended part of each of them., (*4)

Matching by Entity List

Ask your payers to include an object identifier (e.g. their record's id) in the transaction description when sending the funds. Example Description: 12345678, (*5)

// Pass basic strings
$matcher = new \SebastianWalker\Statement\Matchers\ListMatcher(["1234","5678","9012"]);

// OR set a property which will be matched
$matcher = new \SebastianWalker\Statement\Matchers\ListMatcher([
    ["id"=>"1234"],
    ["id"=>"5678"],
    ["id"=>"9012"]
], "id");

// Get all matching entities that are referenced in a given transaction
$matches = $matcher->getEntities($transaction);

The list matcher looks for occurences in the transaction's description of the items contained in the given list and returns all matching items., (*6)

The Versions

09/04 2018

dev-master

9999999-dev

Read, parse and match bank statements

  Sources   Download

CC-BY-SA-4.0

The Requires

 

The Development Requires

by Sebastian Walker

09/04 2018

v1.6.2

1.6.2.0

Read, parse and match bank statements

  Sources   Download

CC-BY-SA-4.0

The Requires

 

The Development Requires

by Sebastian Walker

08/04 2018

v1.6

1.6.0.0

Read, parse and match bank statements

  Sources   Download

CC-BY-SA-4.0

The Requires

 

The Development Requires

by Sebastian Walker

01/03 2018

v1.4

1.4.0.0

Read, parse and match bank statements

  Sources   Download

CC-BY-SA-4.0

The Requires

 

The Development Requires

by Sebastian Walker

01/03 2018

v1.5

1.5.0.0

Read, parse and match bank statements

  Sources   Download

CC-BY-SA-4.0

The Requires

 

The Development Requires

by Sebastian Walker

01/03 2018

v1.3

1.3.0.0

Read, parse and match bank statements

  Sources   Download

CC-BY-SA-4.0

The Requires

 

The Development Requires

by Sebastian Walker

01/03 2018

v1.2

1.2.0.0

Read, parse and match bank statements

  Sources   Download

CC-BY-SA-4.0

The Requires

 

The Development Requires

by Sebastian Walker

01/03 2018

v1.1

1.1.0.0

Read, parse and match bank statements

  Sources   Download

CC-BY-SA-4.0

The Requires

 

The Development Requires

by Sebastian Walker

01/03 2018

v1.0

1.0.0.0

Read, parse and match bank statements

  Sources   Download

CC-BY-SA-4.0

The Requires

 

The Development Requires

by Sebastian Walker