bmdevel/bav
Composer 安装命令:
composer require bmdevel/bav
包简介
BAV provides validation for German Bank Accounts (Konto)
README 文档
README
BAV (bank account validator) is a validation library for German bank accounts. Its based among other things on https://www.bundesbank.de/Redaktion/DE/Downloads/Aufgaben/Unbarer_Zahlungsverkehr/pruefzifferberechnungsmethoden.pdf?__blob=publicationFile
Installation
Use Composer:
{
"require": {
"malkusch/bav": "^1"
}
}
Configuration
You can use BAV out of the box. BAV comes with a ready to play default
configuration (DefaultConfiguration):
-
UTF-8encoding (if supported) -
FileDataBackendContainer. I.e. it uses binary search on the file from the Bundesbank. Note that this data backend uses the directorybav/datafor install and update operations. You have to make sure that this directory is writable. -
automatic installation. You don't have to call any installation script. The container will download the Bundesbank file upon the first execution.
-
update plan which triggers an E_USER_NOTICE if the Bundesbank file is outdated.
You can define your own configuration by calling
ConfigurationRegistry::setConfiguration()
or preferably creating the file bav/configuration.php which returns a
Configuration object:
namespace malkusch\bav; $configuration = new DefaultConfiguration(); $pdo = new \PDO("mysql:host=localhost;dbname=test;charset=UTF8"); $configuration->setDataBackendContainer(new PDODataBackendContainer($pdo)); $configuration->setUpdatePlan(new AutomaticUpdatePlan()); return $configuration;
Update
The Bundesbank releases new files for March, June, September and December. BAV needs those new files. You have several possiblities to update bav:
Script
Call bin/bav-update.php.
Programmatically
use malkusch\bav\BAV; $bav = new BAV(); $bav->update();
Automatic
Enable automatic updates with
AutomaticUpdatePlan
in your bav/configuration.php:
namespace malkusch\bav; $configuration = new DefaultConfiguration(); $configuration->setUpdatePlan(new AutomaticUpdatePlan()); return $configuration;
This automatic update plan will perform long running update operations as a shutdown hook. I.e. it won't bother users during normal operations.
Usage
You can use BAV with the api facade
BAV:
-
BAV::isValidBank($bankID): Returns true for existing bank ids. -
BAV::isValidBankAccount($bankID, $account): Returns true for existing accounts of an existing bank. -
BAV::isValidAccount($account): This method validates an account against the bank of the lastisValidBank()call. -
BAV::getValidBankFilterCallback(): Returns a callback for filter bank validation. -
BAV::getValidAccountFilterCallback(): Returns a callback for filter account validation. The account filter needs to be called after the bank filter. -
BAV::getMainAgency(): Returns the main agency of a bank. -
BAV::getAgencies(): Returns further agencies. The main agency is not included in this list. This list can be empty.
An Agency
object has the fields:
Example
use malkusch\bav\BAV; $bav = new BAV(); $bankID = "10000000"; $account = "1234567890" // check for a bank var_dump( $bav->isValidBank($bankID) ); // check for a bank account var_dump( $bav->isValidBankAccount($bankID, $account) ); // filter validation var_dump( filter_var($bankID, FILTER_CALLBACK, $bav->getValidBankFilterCallback()), filter_var($account, FILTER_CALLBACK, $bav->getValidAccountFilterCallback()) ); // Get informations about a bank $agency = $bav->getMainAgency($bankID); echo "{$agency->getName()} {$agency->getCity()}\n";
See also bav/docs/example.php.
Optional Dependencies
You may have:
-
CURL: If you provide
bav/data/banklist.txtyou don't need CURL. -
mbstring: BAV works with unicode encoding. Your PHP must have support compiled in the
mb_*functions. If these functions are missing BAV works only with the ISO-8859-15 encoding. -
PDO: If you intend to use a DBS you need to use
PDODataBackendContainer.PDODataBackendContainerneeds aPDOsupport compiled in PHP. -
doctrine/orm: You can use
DoctrineBackendContainerwhich uses doctrine as data backend.
License and authors
This project is free and under the WTFPL. So do what ever you want. But it would be nice to leave a note about the authors.
The author of the original project which gave the idea to this project is Björn Wilmsmann. Responsable for this project is Markus Malkusch markus@malkusch.de.
Donations
If you like BAV and feel generous donate a few Bitcoins here: 1335STSwu9hST4vcMRppEPgENMHD2r1REK
bmdevel/bav 适用场景与选型建议
bmdevel/bav 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 64.32k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2015 年 12 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「validation」 「check」 「Bank」 「account」 「bankaccount」 「konto」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 bmdevel/bav 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bmdevel/bav 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 bmdevel/bav 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Symfony bundle for chameleon-system/sanitycheck
This Extension integrates a credit check and more made by the LEONEX Risk Management Platform into your order process. Extensive configuration and evaluation options is provided in the Platform
Symfony integration for Czech bank account library
SoftWax Health Check Bundle for Symfony framework
Check for holidays - localeaware
统计信息
- 总下载量: 64.32k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 26
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: WTFPL
- 更新时间: 2015-12-15