midassoft/dominicanbankparser
Composer 安装命令:
composer require midassoft/dominicanbankparser
包简介
Dominican Bank parser
README 文档
README
This package allows you to parse files from the major dominican Bank entities.
Requirements
PHP ^7.1.3
Installation
composer require "midassoft/dominicanbankparser"
Usage
Just select the parser you want to use and call the parse method with the file content.
use MidasSoft\DominicanBankParser\Files\CSV; use MidasSoft\DominicanBankParser\Parsers\BHDBankParser; $parser = new BHDBankParser(); $file = file_get_contents(__DIR__.'/bhd_bank_file.csv'); $result = $parser->parse(new CSV($file));
This will return a collection of Deposit objects.
object(MidasSoft\DominicanBankParser\Collections\DepositCollection)#302 (1) {
["items":protected]=>
array(91) {
[0]=>
object(MidasSoft\DominicanBankParser\Deposit)#23 (4) {
["amount":"MidasSoft\DominicanBankParser\Deposit":private]=>
string(7) "4000.00"
["date":"MidasSoft\DominicanBankParser\Deposit":private]=>
string(10) "19/12/2017"
["description":"MidasSoft\DominicanBankParser\Deposit":private]=>
string(15) "DEPOSITO:3228-4"
["term":"MidasSoft\DominicanBankParser\Deposit":private]=>
string(15) "DEPOSITO:3228-4"
}
[1]=>
object(MidasSoft\DominicanBankParser\Deposit)#24 (4) {
["amount":"MidasSoft\DominicanBankParser\Deposit":private]=>
string(8) "11805.00"
["date":"MidasSoft\DominicanBankParser\Deposit":private]=>
string(10) "19/12/2017"
["description":"MidasSoft\DominicanBankParser\Deposit":private]=>
string(19) "DEPOSITO:6051-7/195"
["term":"MidasSoft\DominicanBankParser\Deposit":private]=>
string(19) "DEPOSITO:6051-7/195"
}
}
}
You can especify a cache manager in your parser if you want your data to persist , every parse will be automatically cached.
use MidasSoft\DominicanBankParser\Files\CSV; use MidasSoft\DominicanBankParser\Parsers\BHDBankParser; $parser = new BHDBankParser(new FileCacheDriver([ 'path' => __DIR__.'/cache', 'timezone' => 'America/Santo_Domingo', ])); $file = file_get_contents(__DIR__.'/bhd_bank_file.csv'); $result = $parser->parse(new CSV($file)); $cacheKeys = $parser->getCacheManager()->getKeys(); $parsedFromCache = $parser->getCacheManager()->get(end($cacheKeys));
There's two cache driver available ArrayCacheDriver and FileCacheDriver. When you use the FileCacheDriver you need to specify the path and timezone within your configuration.
Also you can write your own parsers by extending the MidasSoft\DominicanBankParser\Parsers\AbstractParser class, and your own cache drivers by extending MidasSoft\DominicanBankParser\Cache\AbstractCacheDriver.
Supported banks
- BHD
- Popular
- Reservas
- Santa Cruz
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-10-22