-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented missing entities, Implemented parsers, and normalizer for…
… ofx content string
- Loading branch information
1 parent
25beab3
commit f7b9e25
Showing
39 changed files
with
3,064 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
charset = utf-8 | ||
|
||
# 4 space indentation | ||
[*.php] | ||
indent_style = space | ||
indent_size = 4 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Copyright (c) 2024 The Authors of ofx-php-parser | ||
|
||
Wes Guirra - wesguirra@icloud.com | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# OFX PHP Parser | ||
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](https://getcomposer.org/): | ||
|
||
```bash | ||
$ composer require endeken/ofx-php-parser | ||
``` | ||
|
||
## Usage | ||
This project primarily revolves around the `OFX` class in the `Endeken\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 | ||
<?php | ||
|
||
require 'vendor/autoload.php'; | ||
|
||
use Endeken\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 a standalone project, however it is heavily influenced by the work done in the [asgrim/ofxparser](https://github.com/asgrim/ofxparser) which itself is a fork of [grimfor/ofxparser](https://github.com/grimfor/ofxparser). We would like to acknowledge the contributions made by the developers of these projects. Our intent was not to simply fork the project, but to build upon their work while taking the library in a slightly different direction to better serve our purposes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Endeken\OFX; | ||
|
||
class AccountInfo | ||
{ | ||
/** | ||
* @var string $description The account description | ||
*/ | ||
public string $description; | ||
|
||
/** | ||
* @var string $number The account number. | ||
*/ | ||
public string $number; | ||
|
||
public function __construct(string $description, string $number) | ||
{ | ||
$this->description = $description; | ||
$this->number = $number; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
namespace Endeken\OFX; | ||
|
||
use DateTime; | ||
|
||
class BankAccount | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
public string $accountNumber; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
public string $accountType; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
public string $balance; | ||
|
||
/** | ||
* @var DateTime | ||
*/ | ||
public DateTime $balanceDate; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
public string $routingNumber; | ||
|
||
/** | ||
* @var Statement | ||
*/ | ||
public Statement $statement; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
public string $transactionUid; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
public string $agencyNumber; | ||
|
||
public function __construct( | ||
string $accountNumber, | ||
string $accountType, | ||
string $agencyNumber, | ||
string $routingNumber, | ||
string $balance, | ||
DateTime $balanceDate, | ||
string $transactionUid, | ||
Statement $statement, | ||
) | ||
{ | ||
$this->accountNumber = $accountNumber; | ||
$this->accountType = $accountType; | ||
$this->agencyNumber = $agencyNumber; | ||
$this->routingNumber = $routingNumber; | ||
$this->balance = $balance; | ||
$this->balanceDate = $balanceDate; | ||
$this->transactionUid = $transactionUid; | ||
$this->statement = $statement; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Endeken\OFX; | ||
|
||
class Institute | ||
{ | ||
/** | ||
* @var string The ID of the institute | ||
*/ | ||
public string $id; | ||
|
||
/** | ||
* @var string This variable stores the institute name. | ||
*/ | ||
public string $name; | ||
|
||
public function __construct(string $id, string $name) | ||
{ | ||
$this->id = $id; | ||
$this->name = $name; | ||
} | ||
} |
Oops, something went wrong.