jschaedl/iban-validation
Composer 安装命令:
composer require jschaedl/iban-validation
包简介
A small library for validating International BankAccount Numbers (IBANs).
关键字:
README 文档
README
A message to Russian 🇷🇺 people
If you currently live in Russia, please read this message.
Purpose
A small library for validating International Bankaccount Numbers (IBANs) based on the IBAN Registry provided by SWIFT. See https://www.swift.com/standards/data-standards/iban for more information.
Development status
This library is ready to use. The Iban validation should be fine, but there is no warranty. Please use it at your own risk.
Features
- full country support of IBAN validation based on SWIFT Registry
- customizable violation messages
- simple to use object-oriented api
- high test coverage
- DIC friendly
Installation
To install jschaedl/iban-validation via composer use
$ composer require jschaedl/iban-validation
You can see this library on Packagist.
Iban Validation
<?php use Iban\Validation\Validator; use Iban\Validation\Iban; $iban = new Iban('DE89 3704 0044 0532 0130 00'); $validator = new Validator(); if (!$validator->validate($iban)) { foreach ($validator->getViolations() as $violation) { echo $violation; } }
You can also customize the violation messages by providing them via configuration. Just create a Validator passing a config array as constructor argument.
<?php use Iban\Validation\Validator; $validator = new Validator([ 'violation.unsupported_country' => 'The requested country is not supported!', 'violation.invalid_length' => 'The length of the given Iban is not valid!', 'violation.invalid_format' => 'The format of the given Iban is not valid!', 'violation.invalid_checksum' => 'The checksum of the given Iban is not valid!', ]);
You can pass true to the second argument of the Validator::validate(string|Iban $iban, bool $throw = false) in order
to retrieve exceptions thrown on validation errors.
$validator = new Validator(); try { $validator->validate(new Iban('DE89 3704 0044 0532 0130 00'), throw: true); } catch (Exception $exception) { // ... }
Iban Information
<?php use Iban\Validation\Iban; use Iban\Validation\CountryInfo; $iban = new Iban('IBAN DE89 3704 0044 0532 0130 00'); $iban->countryCode(); // 'DE' $iban->checksum(); // '89' $iban->bban(); // '370400440532013000' $iban->bbanBankIdentifier(); // '37040044' $iban->format(Iban::FORMAT_PRINT); // 'DE89 3704 0044 0532 0130 00' $iban->format(Iban::FORMAT_ELECTRONIC); // 'DE89370400440532013000' $iban->format(Iban::FORMAT_ANONYMIZED); // 'XXXXXXXXXXXXXXXXXX3000' $countryInfo = new CountryInfo('DE'); $countryInfo->getCountryName(); // 'Germany' $countryInfo->getIbanStructureSwift(); // 'DE2!n8!n10!n' $countryInfo->getBbanStructureSwift(); // '8!n10!n' $countryInfo->getIbanRegex(); // '/^DE\d{2}\d{8}\d{10}$/' $countryInfo->getBbanRegex(); // '/^\d{8}\d{10}$/' $countryInfo->getIbanLength(); // 22 $countryInfo->getBbanLength(); // 18 $countryInfo->getIbanPrintExample(); // 'DE89 3704 0044 0532 0130 00' $countryInfo->getIbanElectronicExample(); // 'DE89370400440532013000'
How to contribute
If you want to fix some bugs or want to enhance some functionality, please fork one of the release branches and create your own development branch. Then fix the bug you found or add your enhancements and make a pull request. Please commit your changes in tiny steps and add a detailed description on every commit.
All pull requests must be accompanied by following coding style and static code analysis rules and passing unit tests. You can run all checks and tests by executing:
$ make it
Author
License
MIT License
jschaedl/iban-validation 适用场景与选型建议
jschaedl/iban-validation 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.16M 次下载、GitHub Stars 达 102, 最近一次更新时间为 2018 年 08 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「validation」 「IBAN」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jschaedl/iban-validation 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jschaedl/iban-validation 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jschaedl/iban-validation 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This package parses and validates International Bank Account Number (IBAN).
PHP IBAN - This library provides a converter for account number, bank code and IBAN.
Extensions for Laravel validation rules to validate national person and company identifiers
Adds request-parameter validation to the SLIM 3.x PHP framework
A jQuery augmented PHP library for creating and validating HTML forms
PHP Iban & Bic Library
统计信息
- 总下载量: 3.16M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 103
- 点击次数: 33
- 依赖项目数: 17
- 推荐数: 2
其他信息
- 授权协议: MIT
- 更新时间: 2018-08-17