kalisport / ofx-php-parser
OFX PHP parser library
Installs: 64
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 2
pkg:composer/kalisport/ofx-php-parser
Requires
- ext-libxml: *
- ext-mbstring: *
- ext-simplexml: *
Requires (Dev)
- phpunit/phpunit: ^11.0
README
This project consists of a PHP parser for OFX (Open Financial Exchange) files, implemented using PHP 8.2. Our aim is to make the process of importing OFX files as straightforward and hassle-free as possible.
Installation
Simply require the package using Composer:
$ composer require kalisport/ofx-php-parser
Usage
This project primarily revolves around the OFX class in the Kalisport\OFX namespace. This class provides a static function parse() which is used to parse OFX data and return the parsed information. Here is a basic usage example:
<?php require 'vendor/autoload.php'; use Kalisport\OFX\OFX; try { // Load the OFX data $ofxData = file_get_contents('path_to_your_ofx_file.ofx'); // Parse the OFX data $parsedData = OFX::parse($ofxData); // $parsedData is an instance of OFXData which gives you access to all parsed data // Access the sign-on status code $statusCode = $parsedData->signOn->status->code; // Accessing bank accounts data $bankAccounts = $parsedData->bankAccounts; foreach($bankAccounts as $account) { echo 'Account ID: ' .$account->accountNumber . PHP_EOL; echo 'Bank ID: ' .$account->routingNumber . PHP_EOL; // Loop through each transaction foreach ($account->statement->transactions as $transaction) { echo 'Transaction Type: ' . $transaction->type . PHP_EOL; echo 'Date: ' . $transaction->date . PHP_EOL; echo 'Amount: ' . $transaction->amount . PHP_EOL; } } } catch (Exception $e) { echo 'An error occurred: ' . $e->getMessage(); }
Acknowledgements
This library is an independent project; however, it draws significant inspiration from the work done on endeken-com/ofx-php-parser, which is itself a fork of asgrim/ofxparser, originally derived from grimfor/ofxparser.
We would like to express our appreciation to the developers of these projects for their valuable contributions. Our intention was not to create a direct fork, but rather to build upon their efforts and guide the library in a slightly different direction to better address our specific requirements.