eibanvalidator International Bank Account Number Validator

  1. Requirements
  2. Usage
  3. Note
  4. Resources
  5. Change Log
  6. version 1.0

This is a International Bank Account Number Validator.

I have created a GitHub repository for those willing to contribute on any of the extensions I created. Please, check the link at the bottom of this wiki.

Requirements

Developed using Yii 1.1.6

Usage

Unzip the contents of the package and place it on your protected/extensions folder, then you can use the validator in the following ways:

As an attribute validator

// On your model's rules function
public function rules()
{
   return array(
     array('<attributename>','ext.validators.EIBANValidator',
    );
 
}

As standalone class

// Testing all possible combinations
$iban_tester = array(
'AD'=>array('country'=>'Andorra','example'=>'AD1200012030200359100100'),
'AT'=>array('country'=>'Austria','example'=>'AT611904300234573201'),
'BE'=>array('country'=>'Belgium','example'=>'BE68539007547034'),
'BA'=>array('country'=>'Bosnia and Herzegovina','example'=>'BA391290079401028494'),
'BG'=>array('country'=>'Bulgaria','example'=>'BG80BNBG96611020345678'),
'HR'=>array('country'=>'Croatia','example'=>'HR1210010051863000160'),
'CY'=>array('country'=>'Cyprus','example'=>'CY17002001280000001200527600'),
'CZ'=>array('country'=>'Czech Republic','example'=>'CZ6508000000192000145399'),
'DK'=>array('country'=>'Denmark','example'=>'DK5000400440116243'),
'EE'=>array('country'=>'Estonia','example'=>'EE382200221020145685'),
'FI'=>array('country'=>'Finland','example'=>'FI2112345600000785'),
'FR'=>array('country'=>'France','example'=>'FR1420041010050500013M02606'),
'PF'=>array('country'=>'French Polynesia','example'=>'PF5720041010050500013M02606'),
'TF'=>array('country'=>'French Southern Territories','example'=>'TF2120041010050500013M02606'),
'YT'=>array('country'=>'Mayotte','example'=>'YT3120041010050500013M02606'),
'NC'=>array('country'=>'New Caledonia','example'=>'NC8420041010050500013M02606'),
'PM'=>array('country'=>'Saint Pierre et Miquelon','example'=>'PM3620041010050500013M02606'),
'WF'=>array('country'=>'Wallis and Futuna Islands','example'=>'WF9120041010050500013M02606'),
'DE'=>array('country'=>'Germany','example'=>'DE89370400440532013000'),
'GI'=>array('country'=>'Gibraltar','example'=>'GI75NWBK000000007099453'),
'GR'=>array('country'=>'Greece','example'=>'GR1601101250000000012300695'),
'HU'=>array('country'=>'Hungary','example'=>'HU42117730161111101800000000'),
'IS'=>array('country'=>'Iceland','example'=>'IS140159260076545510730339'),
'IE'=>array('country'=>'Ireland','example'=>'IE29AIBK93115212345678'),
'IT'=>array('country'=>'Italy','example'=>'IT60X0542811101000000123456'),
'LV'=>array('country'=>'Latvia','example'=>'LV80BANK0000435195001'),
'LI'=>array('country'=>'Liechtenstein (Principality of)','example'=>'LI21088100002324013AA'),
'LT'=>array('country'=>'Lithuania','example'=>'LT121000011101001000'),
'LU'=>array('country'=>'Luxembourg','example'=>'LU280019400644750000'),
'MK'=>array('country'=>'Macedonia','example'=>'MK07250120000058984'),
'MT'=>array('country'=>'Malta','example'=>'MT84MALT011000012345MTLCAST001S'),
'MU'=>array('country'=>'Mauritius','example'=>'IBAN MU17 BOMM 0101 1010 3030 0200 000M UR'),
'MC'=>array('country'=>'Monaco','example'=>'MC1112739000700011111000h79'),
'ME'=>array('country'=>'Montenegro','example'=>'ME25505000012345678951'),
'NL'=>array('country'=>'The Netherlands','example'=>'NL91ABNA0417164300'),
'NO'=>array('country'=>'Norway','example'=>'NO9386011117947'),
'PL'=>array('country'=>'Poland','example'=>'PL61109010140000071219812874'),
'RO'=>array('country'=>'Romania','example'=>'RO49AAAA1B31007593840000'),
'SM'=>array('country'=>'San Marino','example'=>'SM86U0322509800000000270100'),
'SA'=>array('country'=>'Saudi Arabia','example'=>'SA0380000000608010167519'),
'RS'=>array('country'=>'Serbia','example'=>'RS35260005601001611379'),
'SK'=>array('country'=>'Slovak Republic','example'=>'SK3112000000198742637541'),
'SI'=>array('country'=>'Slovenia','example'=>'SI56191000000123438'),
'ES'=>array('country'=>'Spain','example'=>'ES9121000418450200051332'),
'SE'=>array('country'=>'Sweden','example'=>'SE4550000000058398257466'),
'CH'=>array('country'=>'Switzerland','example'=>'CH9300762011623852957'),
'TN'=>array('country'=>'Tunisia','example'=>'TN5910006035183598478831'),
'TR'=>array('country'=>'Turkey','example'=>'TR330006100519786457841326'),
'GB'=>array('country'=>'United Kingdom','example'=>'GB29NWBK60161331926819'),
'PT'=>array('country'=>'Portugal','example'=>'PT50000201231234567890154'));

Yii::import('ext.validators.*');
	
$iban = new EIBANValidator();
	
foreach($iban_tester as $test){
	$result = $iban->validateIBAN($test['example']);
	echo 'VALIDATING '.$test['example'].' '.
             strtoupper($test['country']).': <strong>'.
             ($result===true?
                 'Valid Format':
                  $iban->getErrorMessage($result, $test['example'])) .
             '</strong><br/>';
	}

Note

Please make use of the forum post to report errors, requests, and suggestions. Let comments on this extension for coding hints.

Resources

Change Log

version 1.0

  • Initial Public Release
2 0
7 followers
715 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Validation
Developed by: Antonio Ramirez
Created on: Feb 17, 2011
Last updated: 12 years ago

Downloads

show all

Related Extensions