PHPackages                             slackero/php-iban - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. slackero/php-iban

ActiveLibrary

slackero/php-iban
=================

php-iban is a library for parsing and validating IBAN (and IIBAN) bank account information.

v5.0.0(2y ago)03LGPL-3.0-onlyPHPPHP ^7.4 || ^8.0 || ^8.1 || ^8.2 || ^8.3

Since Jan 14Pushed 2y agoCompare

[ Source](https://github.com/slackero/php-iban)[ Packagist](https://packagist.org/packages/slackero/php-iban)[ RSS](/packages/slackero-php-iban/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

php-iban
========

[](#php-iban)

`php-iban` is a library for parsing, validating and generating IBAN (and IIBAN) bank account information in PHP.

This is a fork of the original [**globalcitizen/php-iban**](https://github.com/globalcitizen/php-iban/). Instead of parsing the IBAN registry from a CSV file on each load it uses a PHP file that is generated from the CSV file. In addition support for PHP &lt;7.4 was removed and the code was cleaned up a bit.

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](https://raw.githubusercontent.com/slackero/php-iban/master/docs/COMEDY-OF-ERRORS).

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 January 2020 release, ie. PDF release #86](https://www.swift.com/standards/data-standards/iban).

License
-------

[](#license)

Licensed under LGPL, it is free to use in commercial settings.

Countries Supported
-------------------

[](#countries-supported)

The following 116 official and *unofficial* IBAN countries are supported.

- Albania (AL)
- *Algeria* (DZ)
- Andorra (AD)
- *Angola* (AO)
- Austria (AT)
- Azerbaijan (AZ)
- Bahrain (BH)
- Belarus (BY)
- Belgium (BE)
- *Benin* (BJ)
- Bosnia and Herzegovina (BA)
- Brazil (BR)
- British Virgin Islands (VG)
- Bulgaria (BG)
- *Burkina Faso* (BF)
- *Burundi* (BI)
- *Cameroon* (CM)
- *Central African Republic* (CF)
- *Chad* (TD)
- *Cape Verde* (CV)
- *Comoros* (KM)
- *Congo* (CG)
- Costa Rica (CR)
- *Côte d'Ivoire* (CI)
- Croatia (HR)
- Cyprus (CY)
- Czech Republic (CZ)
- Denmark (DK)
    - Faroe Islands (FO)
    - Greenland (GL)
- *Djibouti* (DJ)
- Dominican Republic (DO)
- East Timor (TL)
- *Egypt* (EG)
- El Salvador (SV)
- *Equitorial Guinea* (GQ)
- Estonia (EE)
- Finland (FI)
    - Åland Islands (AX)
- France (FR)
    - French Guiana (GF)
    - French Polynesia (PF)
    - French Southern Territories (TF)
    - Guadelope (GP)
    - Martinique (MQ)
    - Mayotte (YT)
    - New Caledonia (NC)
    - Réunion (RE)
    - Saint Barhélemy (BL)
    - Saint Martin (French Part) (MF)
    - Saint-Pierre and Miquelon (PM)
    - Wallis and Futuna (WF)
- *Gabon* (GA)
- Georgia (GE)
- Germany (DE)
- Gibraltar (GI)
- Greece (GR)
- Guatemala (GT)
- *Guinea-Bissau* (GW)
- *Honduras* (HN)
- Hungary (HU)
- Iceland (IS)
- *IIBAN (Internet)* (AA)
- *Iran* (IR)
- Iraq (IQ)
- Ireland (IE)
- Israel (IL)
- Italy (IT)
- Jordan (JO)
- Kazakhstan (KZ)
- Kosovo (XK)
- Kuwait (KW)
- Latvia (LV)
- Lebanon (LB)
- Liechtenstein (LI)
- Lithuania (LT)
- Luxembourg (LU)
- Macedonia (MK)
- *Madagascar* (MG)
- *Mali* (ML)
- Malta (MT)
- Mauritania (MR)
- Mauritius (MU)
- Moldova (MD)
- Monaco (MC)
- Montenegro (ME)
- *Morocco* (MA)
- *Mozambique* (MZ)
- Netherlands (NL)
- *Nicaragua* (NI)
- *Niger* (NE)
- Norway (NO)
- Pakistan (PK)
- Palestine (PS)
- Poland (PL)
- Portugal (PT)
- Qatar (QA)
- Romania (RO)
- Saint Lucia (LC)
- San Marino (SM)
- São Tomé and Príncipe (ST)
- Saudi Arabia (SA)
- *Senegal* (SN)
- Serbia (RS)
- Seychelles (SC)
- Slovakia (SK)
- Slovenia (SI)
- Spain (ES)
- Sweden (SE)
- Switzerland (CH)
- *Togo* (TG)
- Tunisia (TN)
- Turkey (TR)
- *Ukraine* (UA)
- United Arab Emirates (AE)
- United Kingdom (GB)

Installation via composer
-------------------------

[](#installation-via-composer)

If you use [composer](https://getcomposer.org/) you can simply run `composer require globalcitizen/php-iban` to get going.

(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.1"
    }
}

```

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 slackero/php-iban

# or you can simply execute composer command if you set it to
# your PATH environment variable
$ composer install
$ composer update slackero/php-iban
```

You can [see this library on Packagist](https://packagist.org/packages/slackero/php-iban).

Installation via git
--------------------

[](#installation-via-git)

For a regular install, use the `git clone` command:

```
# HTTP
$ git clone https://github.com/slackero/php-iban.git
# SSH
$ git clone git@github.com:slackero/php-iban.git
```

Installation via git submodule
------------------------------

[](#installation-via-git-submodule)

Alternatively, 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/slackero/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 git@your-server.com:your/project.git
# initialize submodules
$ git submodule init
# update submodules
$ git submodule update
```

To 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 git@your-server.com:your/project.git
```

If 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'
```

Manual installation
-------------------

[](#manual-installation)

1. Fetch the latest release from [our github releases page](https://github.com/slackero/php-iban/releases) in either `zip` or `tar.gz` format.
2. Extract the library using your favourite archive utility, for example `unzip filename.zip` on Unix-like platforms.
3. Write your code to depend on the library based upon its relative location to your source code. For example if you wish to include `php-iban` from the parent directory's subdirectory `libraries/php-iban` you could use the following [`require_once`](http://php.net/manual/en/function.require-once.php) statement:

```
