Skip to content

Bank for PHP is a very small and easy-to-use library for works with bank account

License

Notifications You must be signed in to change notification settings

ondrakub/bank-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bank for PHP

Total Downloads Build Status Latest Stable Version License

Bank for PHP is a very small and easy-to-use library for works with bank account

Install

via composer

php composer.phar require ondrakub/bank-php

Usage

It is simple to use. Just call static methods Bank::getName($code) for getting name of bank and Bank::getCodes($name) for getting an array of codes of banks

try {

	echo Bank::getName(3030);

} catch (BankException $e) {
	echo 'Error: '. $e->getMessage();
}


try {

	$codes = Bank::getCodes('bank');

	foreach ($codes as $key => $value) {
		echo $key . ' - '. $value . '<br>';
	}

} catch (BankException $e) {
	echo 'Error: '. $e->getMessage();
}

Or you can work with account number

try {

	//accept xx-xx/xxxx, xx/xxxx, 00-xx/xxxx
	$bank = new Bank('1135595026/3030');

	echo 'account number: ' . $bank->getAccount() . '<br>';
	echo 'full account number: ' . $bank->getAccount(Bank::ZERO) . '<br>';
	echo 'prefix: ' . $bank->getPrefix() . '<br>';
	echo 'prefix with zero: ' . $bank->getPrefix(Bank::ZERO) . '<br>';
	echo 'number: ' . $bank->getNumber() . '<br>';
	echo 'number with zero: ' . $bank->getNumber(Bank::ZERO) . '<br>';
	echo 'code: ' . $bank->getCode() . '<br>';
	echo 'valid account: ' . $bank->isValid() . '<br>';
	echo 'IBAN: ' . $bank->getIban() . '<br>';
	echo 'formatted IBAN: ' . $bank->getIban(Bank::FORMATTED) . '<br>';
	echo 'BIC code (SWIFT): ' . $bank->getBic();

} catch (BankException $e) {
	echo 'Error: '. $e->getMessage();
}

About

Bank for PHP is a very small and easy-to-use library for works with bank account

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages