在 PHP 中生成、解析、验证、纠正错误并显示 IBAN (以及 IIBAN) 银行账户信息。
php-iban is a library for parsing, validating and generating IBAN (and IIBAN) bank account information in PHP.
All parts of an IBAN can be retrieved, including country code, checksum, BBAN, financial institution or bank code, account number, and where a fixed-length national system is in use, also branch/sort code. Legacy national checksums may also be retrieved, validated and correctly set, where available, whether they apply to the account number portion, bank and branch identifiers, part or all of the above. IBAN country codes can be converted in to ISO3166-1 alpha-2 and IANA formats, the parent IBAN country acting as registrar for dependent territories may be queried, the official national currency (ISO4217 alpha code format), central bank name and central bank URL may also be queried to ease integration. IBANs may be converted between human and machine representation. IBANs may be obfuscated for presentation to humans in special circumstances such as relative identification. A database of example/test IBANs from different countries is included. Finally, highly accurate suggestions for originally intended input can be made when an incorrect IBAN is detected and is due to mistranscription error.
The parser was built using regular expressions to adapt the contents of the official IBAN registry available from SWIFT then manually modified for special cases such as errors and omissions in SWIFT's official specifications.
Various deficiencies in the initial adaptation have since been rectified, and the current version should be a fairly correct and reliable implementation.
Where appropriate, European Committee for Banking Standards (ECBS) recommendations have also been incorporated.
Please bear in mind that because the specification changes frequently, it may not be 100% up to date if a new version has been recently released - I do my best though. We are currently thought to be up to date with the December 2024 release, ie. PDF release #99.
Licensed under LGPL, it is free to use in commercial settings.
The following 121 official and unofficial IBAN countries are supported.
If you use composer you can simply run composer require globalcitizen/php-iban to get going. Reportedly (and ) were done via composer.
(If you don't yet have composer and wish to install it in an insecure fashion (not recommended, but convenient) you can run curl -sS https://getcomposer.org/installer | php or wget -O- https://getcomposer.org/installer | php)
Then just add the following to your composer.json file:
// composer.json
{
"require": {
"globalcitizen/php-iban": "4.2.3"
}
}Then, you can install the new dependencies by running composer's update command from the directory where your composer.json file is located:
# install
$ php composer.phar install
# update
$ php composer.phar update globalcitizen/php-iban
# or you can simply execute composer command if you set it to
# your PATH environment variable
$ composer install
$ composer update globalcitizen/php-ibanYou can see this library on Packagist.
For a regular install, use the git clone command:
# HTTP
$ git clone https://github.com/globalcitizen/php-iban.git
# SSH
$ git clone [email protected]:globalcitizen/php-iban.gitAlternatively, to embed the php-iban library in your own git-managed repository at a specific revision number, such that it is possible to update the version in a predictable way while maintaining a larger system that depends upon its functionality:
# enter your project's git repo
$ cd my-existing-project-with-a-git-repo/
# select an appropriate place to create the php-iban subdir
$ cd lib/
# add php-iban as a submodule
$ git submodule add https://github.com/globalcitizen/php-iban.git
# commit new submodule
$ git commit -m 'Add php-iban submodule'Then, when checking out git projects with submodules for the first time, normally you need to make a couple of extra steps:
# check out your project as normal
$ git clone [email protected]:your/project.git
# initialize submodules
$ git submodule init
# update submodules
$ git submodule updateTo skip these steps, add the --recursive argument to git clone when checking out:
# check out your project, initialize and update all submodules
$ git clone --recursive [email protected]:your/project.gitIf you later wish to your project to use a newer version of php-iban, run:
# fetch changes
$ git submodule update --remote php-iban
# commit
$ git commit -m 'Update php-iban submodule'zip or tar.gz format.unzip filename.zip on Unix-like platforms.php-iban from the parent directory's subdirectory libraries/php-iban you could use the following require_once() statement:The following table compares php-iban to other PHP projects offering IBAN-related functionality, on the basis of general project information and the programming paradigms supported.
| Project | Lic. | Proc | OO | Began | Latest | Star | Watch | Fork | Installs | Home culture | Deps |
|---|---|---|---|---|---|---|---|---|---|---|---|
| php-iban | LGPL | ✔ | ✔ | 2009 | 4.2.3 | 426 | 29 | 104 | ~7M+* | Global* | none |
| Iban | MIT | ✘ | ✔ | 2013 | 1.3.0 | 50 | 9 | 19 | 178.39k | German | lots |
| IsoCodes | GPL3 | ✘ | ✔ | 2012 | 2.1.1 | 466 | 22 | 54 | 145k | French | lots |
| SepaUtil's | GPL3 | ✘ | ✔ | 2014 | 1.2.3 | 8 | 4 | 3 | 25k | German | phpunit |
| Symfony | MIT | ✘ | ✔ | 2013 | 3.3.6 | 15k | 1214 | 5.6k | 23M+ | French | lots |
Notes:
Now let's take a look at features.
|
暂无开放 Issues,或尚未同步最近议题。